Use-case :- There will be a common scenario where client asks you to change language dynamically from drop-down. Think drop-down contains English/Spanish how do you accomplish this task.
Portal tag :- This tag will generate the language specific url based on the urlParam passed to it. where language is the two character code for the required language, such as en, de, or fr. For a list of the available languages and their two character codes read Language support.
<portal-navigation:url command="ChangeLanguage">
<portal-navigation:urlParam name="locale" value="language"/>
</portal-navigation:url>
Step 1 :-
For users to be able to dynamically change the language for the session, add a link to the portal theme with the following text and link reference:
The text displayed with the link specifies the language to which the user can change.
The link reference calls the command described previously with the locale parameter corresponding to the specified language.
Step 2 :-
Users can then click this link to change to the language specified by the locale parameter with the command attribute.
Example: - To create links for English andSpanish, add the lines shown in the following example to your theme
<a href="<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale"
value="en"/></portal-navigation:url>">English</a>
<a href="<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale"
value="es"/></portal-navigation:url>">Spanish</a>
Portal tag :- This tag will generate the language specific url based on the urlParam passed to it. where language is the two character code for the required language, such as en, de, or fr. For a list of the available languages and their two character codes read Language support.
<portal-navigation:url command="ChangeLanguage">
<portal-navigation:urlParam name="locale" value="language"/>
</portal-navigation:url>
Step 1 :-
For users to be able to dynamically change the language for the session, add a link to the portal theme with the following text and link reference:
The text displayed with the link specifies the language to which the user can change.
The link reference calls the command described previously with the locale parameter corresponding to the specified language.
Step 2 :-
Users can then click this link to change to the language specified by the locale parameter with the command attribute.
Example: - To create links for English andSpanish, add the lines shown in the following example to your theme
<a href="<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale"
value="en"/></portal-navigation:url>">English</a>
<a href="<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale"
value="es"/></portal-navigation:url>">Spanish</a>
This comment has been removed by the author.
ReplyDeleteGreat!it is really nice blog information.after a long time i have grow through such kind of ideas.thanks for share your thoughts with us.
ReplyDeletePython Training in Chennai
Python Classes in Chennai
Big data training in chennai
JAVA Training in Chennai
Digital Marketing Course in Chennai
Python Training in Chennai
Python Training in Velachery