3

How to add the Language icon image in liferay 7(liferay-ce-portal-7.0-ga4).

I have followed the steps mentioned in following article,

https://web.liferay.com/web/salman.khan/blog/-/blogs/add-a-new-language-to-liferay-detailed-step-by-step- After the language configuration I can be able to see the languages but not the flags on web content forms.

So I created the custom theme to add the language file and added th_TH.png file in theme\src\images\language\th_TH.png. But din't work.

Then I tried the implementing the lexicon-icon approach mention in, how can i add a new language in liferay 7?

Still I am not able to see the language images.

Please refer the screenshot for details, Theme-layout and file location

2 Answers2

3

To add a custom icon that is not supported yet you need to add 2 artefacts into the theme. Liferay using 2 things for displaying icons. Somewhere it uses png flag and somewhere svg you need to adjust both.

Have a look at this sample project. https://github.com/mir333/custom-flag-admin-theme

It takes the admin theme of Liferay (it is a copy so it needs to be kept in sync with updates) and adds a new flag to the admin theme. The magic is in adding the flag into the lexicon. Under the hood, it takes the added flag svg files and recompiles the icons.svg files to include it.

Miroslav Ligas
  • 1,287
  • 8
  • 22
  • Thank you for the reply. I tried to build the custom-flag-admin-theme but can 't generate the War file. Can you please let me know from where I can get the default admin-theme source code,so that I can check out and build? – chandrakant lotke Sep 22 '17 at 10:28
  • I added a README file to the repo. Check it out. – Miroslav Ligas Sep 22 '17 at 10:53
  • Hello Miroslav, I am getting heap size error while deploying admin-theme 09:28:34,917 INFO [fileinstall-D:/LifeRay/liferay-ce-portal-7.0-ga4/osgi/war][PluginPackageUtil:1007] Reading plugin package for admin-theme 09:28:42,250 WARN [fileinstall-D:/LifeRay/liferay-ce-portal-7.0-ga4/osgi/war][com_liferay_portal_osgi_web_wab_extender:103] [admin-theme_1.0.0 [535]] Error while creating extension java.lang.OutOfMemoryError: Java heap space I tried increasing the heap memory as well but still no luck. Any suggesssions? – chandrakant lotke Oct 12 '17 at 09:42
  • What is your mem setting? This is highly irregular behaviour. Can you upload the full stack trace somewhere? – Miroslav Ligas Oct 12 '17 at 13:39
  • I am running liferay with default memory settings. Just downloaded Liferay CE GA4 edition and tried to deploy admin-theme war. Also my computer has 8 GB ram. I am getting out of memory error while Reading the plugin packages for admin-theme.war – chandrakant lotke Oct 17 '17 at 08:42
  • I have create the video for the same hope this will help [link] https://s3.ap-south-1.amazonaws.com/liferay-error/20171017_135131.mp4 – chandrakant lotke Oct 17 '17 at 09:12
  • Please download the video – chandrakant lotke Oct 17 '17 at 09:13
  • Hi @chandrakantlotke I'm unable to download the file. – Miroslav Ligas Oct 18 '17 at 14:01
  • Hi Miroslav, Please try this new link [link] https://s3.ap-south-1.amazonaws.com/liferay-error/20171017_135131.zip – chandrakant lotke Oct 21 '17 at 11:13
  • The sample is from an old project so it works fine on ga1 but has problems with the newer releases. Probably the deps are outdated. I have a look and update the sample. – Miroslav Ligas Oct 22 '17 at 21:02
  • Thanks for the solution,now I am able to deploy the my-admin-theme.war. Howvever After selecting the My Admin in Control panel ->Configuration->instance settings-> Miscellaneous-> Default Control Panel Theme I am not able to see the default icons in many pages. The root cause could be icons.svg is not found. I have attached some screen shots for your reference. [link]https://s3.ap-south-1.amazonaws.com/liferay-error/Basic_web_content_add.PNG [link]https://s3.ap-south-1.amazonaws.com/liferay-error/Web_Content.PNG [link]https://s3.ap-south-1.amazonaws.com/liferay-error/console_logs.PNG – chandrakant lotke Oct 24 '17 at 06:26
  • I fixed a sample. while updating the code I removed some needed changes :) BTW if the answer helps you consider to mark it as answered. – Miroslav Ligas Oct 24 '17 at 07:53
  • I am not able to see any changes in code. Kindly push your changes. I guess the removed changes are `.pipe(plugins.rename(config.targetName))` right? – chandrakant lotke Oct 24 '17 at 09:33
  • I did push the changes – Miroslav Ligas Oct 24 '17 at 11:43
  • @MiroslavLigas i have similar issue with 7.2, i have created a theme, added svg icons & lexicon icons as described it's still not working, is there any changes i need to follow for 7.2? i will appreciate your help. – Dipti Ranparia Oct 20 '20 at 16:24
0

To anyone who still have issue showing the flag, I just want to point out that this helped me: https://stackoverflow.com/a/45907250

As described, open the icons.svg and add your flag's svg code in as a symbol with the id "xx-yy" (your language and country code, in lowercase).

The flag does not magically generate just from putting the flags-xx-YY.svg file into lexicon folder, not for me at least.