Liferay Language switch issue - liferay

I am trying to implement multiple language support in my liferay Project. For this i added below code in portal_normal.vmfile of theme.
#set( $availLanguage = $stringUtil.split("hi_IN,en_US"))
<span id="language">$taglibLiferay.language("fm", null, "languageId", $toto, 0)</span>
which will add support for two language Hindi,English (United States).
and created hook for multiple language properties files.
<hook>
<language-properties>content/Language_hi.properties</language-properties>
<language-properties>content/Language_en.properties</language-properties>
</hook>
but whenever i switch my language its not changing.It always shows values from Language_en.properties file
so to check whats happening i tried printing below values in theme
$theme_display.getLanguageId()
$locale
but it always shows en_US even thought i changed language to hi_IN.
Looking for help to figure out whats going wrong.
Environment: Liferay 6.1.1 CE GA2

I think you need to add hi_IN language as Available Languages in Portal Settings if it is already not there.
To add this/or verify go to Control Panel --> Portal Settings --> Display Settings
here you will find a input box Available Languages which shows all available locales (comma seperated), make sure you have entry for hi_IN in this input box.

Related

Liferay 6.2 languages switching

In my portal all authenticated users have as default language English. In pages' theme there is a language selector using $taglibLiferay.language("fm", null, "languageId", 3) which gets all languages that I have selected inside portal-ext.properties(locales=en_GB,fr_FR,de_DE).
All these languages are displayed normally in selector, but when a logged-in user tries to switch a language in selector, the selected option remains always the user's language. e.g. A user with English language cannot switch to French. Although, the language changes in selector, the page is reloaded in English with selector's option turned to English.
Does anyone has a workaround on this?
Note: The mappings in web.xml are correct.
Use this:
$taglibLiferay.language("fm", null, "_82_languageId", 3)
or
$theme.language("fm", null, "_82_languageId", 3)

Liferay - Translate

I am using Liferay 6.1.0 GA1.
I added Documents and Media portlet. When I change language in Add menu, it is still named Documents and Media display.
Where I can change that?
Edit: I have hook for translations I just don't know what to write to make it work.
As excepcted for rookie, problem was trivial.
In portlet.xml name wasn't documents-and-media. It was some number.
So then just javax.portlet.title.1= fixed it.
If You don't have a hook, look there -
https://www.liferay.com/community/wiki/-/wiki/Main/Portal+Hook+Plugins
https://www.liferay.com/community/forums/-/message_boards/message/5368654

How to change the Language of portlet's title?

I am trying to change the language of portlet title, but didn't succeed!
I went through the various link from liferay's forum, but unable to achieve my task.
Example:1
Example:2
Details:
I am using following locales fr_FR and zh_CN,with the following values in the concerned properties file
javax.portlet.title.1_WAR_microblogsportlet=News
javax.portlet.title.1_WAR_microblogsportlet=nouvelles(for fr_FR)
javax.portlet.title.1_WAR_microblogsportlet=新聞(for zh_CN)
resource bundle is set in portlet.xml as given:
<portlet-name>1</portlet-name>
<display-name>Microblogs</display-name>
<portlet-class>com.liferay.microblogs.microblogs.portlet.MicroblogsPortlet</por‌​tlet-class>
<resource-bundle>content.Language</resource-bundle>
You just need to have property with key as "javax.portlet.title", no need to put your portlet ID as part of key.
Name the localized properties files and put property value as below.
Language.properties
javax.portlet.title=News
Language_fr.properties
javax.portlet.title=nouvelles
Language_zh.properties
javax.portlet.title=新聞
Then liferay displays portlet in corresponding language depending on user's locale.
You may test in one of below ways.
For User -
In current user profile -> Display Settings, Select language as French and then visit the page having your portlet. It should display title in french instead of english.
Change in URL
You may also specify locale in page URL as described in liferay 6.1 documentation
http://localhost:8080/fr/<your page url>
Using Language portlet
Add Language portlet on your page and clicking on French flag changes locale to french and the page should display portlet title in French.

Change the default language in Liferay

How to change the default for language?
When a user logs in for the first time, the default language is English, and I need to change that.
You can change default language from Control panel - Portal Settings - Display Settings - Default langiuage.
Also you can override params at portal-ext.properties :
#
# Set the default locale used by Liferay. This locale is no longer set at
# the VM level. See LEP-2584.
#
user.country=US
user.language=en
BR,
Paul
From Liferay 7 (released in 2016), the default language setting can be found in the UI at:
Control Panel > Instance Settings > Miscellaneous > Display Settings
Don't forget to press "Save" at the bottom of the page.
As MDT said, it overrides whatever is in portal-ext.properties.

How do you create your own ADF Faces skin?

We are using the default Oracle ADF Faces 10g default skin. It looks super nice, but we want to make tweaks to it (changing the CSS and also how certain components are rendered -- for example the table component will place buttons above and below the table component-- we want them only on the bottom-- this appears to require a programmatic change in order to change this behavior).
Has anyone had success creating their own ADF Faces skin? Please post what you had to do to change component behavior.
we followed this documentation for webcenter spaces:
http://www.oracle.com/technetwork/middleware/webcenter/owcs-r11-extend-spaces-wp-132596.pdf
The documentation makes use of an already existing oracle extension (how to download the source is in the document).
Once we add the application, we simply added a new entry in the META-INF\trinidad-skins.xml :
<?xml version="1.0" encoding="ISO-8859-1"?>
<skins xmlns="http://myfaces.apache.org/trinidad/skin">
<!-- Previous skins here ... -->
<skin>
<id>myskin.custom.desktop</id>
<family>My Skin</family>
<render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
<style-sheet-name>custom/spaces/skins/myskin/myskin.css</style-sheet-name>
<extends>default.desktop</extends>
</skin>
</skins>
and added the css and img files inside the MET-INF directory in the specified paths (e.g. META-INF/custom/spaces/skins/myskin/myskin.css).
For custom applications on ADF the procedure should be the same.
Since Oracle 11g, Oracle prodives the so called 'skin editor' for your ADF applications.
Until 11.1.7.0, the skin editor was only available as an external application. In the current versions, you can choose for which application version you want to create the skin for your ADF Application (the wizard will give you an option for that when creating a new skin project).
Download Skin Editor:
http://www.oracle.com/technetwork/developer-tools/adf/downloads/index.html
Install instructions:
https://docs.oracle.com/middleware/1212/skineditor/ADFSI/adfsi.htm#ADFSI102
However, since 11.1.7.0 the skin editor is integrated with the Oracle JDeveloper IDE. I already used it for a couple of projects. Although it is easy to get into it and to configure your custom skin, you have to keep in mind that you have to do a lot of manual work to "fully" replace the default skin. There are some components which rely on icons - therefore you have to replace them one by one, using graphical editors (e.g. adobe photoshop or another comparable editor that suits you).

Resources