Can we give the user an option to select a language at the start while the user is using a portal so that the contents of the portal get converted to the chosen language? If yes, then how can this be achieved?
Discussion posts and replies are publicly visible
Have you tried displaying a "chooser" page with a dynamicLink which stores the language in a local variable which you pass on to a sub interface?
So for that, we need to set up portals for each language then we have to display accordingly, right?
You could do that and just have a safe link to go between the two. This is you have localized portal title and pages.
Otherwise, you could try something like this:
a!localVariables( local!language, local!bundle: index( { en_US: { test_label: "English" }, fr_CA: { test_label: "Français" } }, local!language, null ), { a!richTextDisplayField( value: { a!richTextItem( text: { a!defaultValue( local!bundle["test_label"], "Choose a language" ), }, link: a!dynamicLink( saveInto: { a!save( local!language, if(local!language = "fr_CA", "en_US", "fr_CA") ) } ) ) } ) } )
I understood, but here we are basically hard coding the labels with different languages, but I am trying to provide support for more than 60 languages (more languages are planned to be added later) throughout the portal which contains several labels. If I go by your suggestion then it will be a very hectic task to develop and maintain that. I just wanted to know if it is possible to convert the labels to a user-selected language seamlessly without hard-coding the contents.
Yes. You can use the load resource bundle plugin, but you will have to expose it via an API since it is not directly supported for Portals.