掲示板

Accessing Liferay translations in FTL

7年前 に Zak Thompson によって更新されました。

Accessing Liferay translations in FTL

Junior Member 投稿: 70 参加年月日: 16/06/13 最新の投稿
In the application I'm working on, the old developer hard coded some strings in English when we actually have translations in place through the Liferay portal that should be there instead. In the code excerpt below, "Guidelines" should be reading the translation from Liferay and not be a static string. However, I've never worked with FTL before and I'm unsure of what syntax to use to get the appropriate title. The title appearing in guidelines should be the very top level page (So if we had a page Guidelines with child page Page 1, which in turn had a child page Child 1, on all three pages the value of title should be Guidelines") . The translations are in place through the Liferay portal, so if you clicked on the page Guidelines inside Liferay and clicked on the flags under the title box, the string switches to the appropriate language already.

console.log(guidelineSiteMap);
new GuidelineSiteMap({
        	"namespace": "${divId}",
			"entry": guidelineSiteMap,
			"title": "Guidelines",
	
	},"${divId}");




	});


<div id="${divId}"></div>


The rest of the code can be provided if necessary, it basically loops through the child pages and creates them. This code is being used for a left navigation menu.
thumbnail
7年前 に Travis Cory によって更新されました。

RE: Accessing Liferay translations in FTL

Junior Member 投稿: 73 参加年月日: 13/06/04 最新の投稿
Hello Zak,

if you look at the other template files in freemarker you'll see
&lt;@liferay.language key="" /&gt;
where key is the text you want to be translated. You can see more information about the Liferay language properties features on dev.liferary.com https://dev.liferay.com/develop/learning-paths/themes/-/knowledge_base/6-2/creating-language-keys-for-your-theme-settings
7年前 に Zak Thompson によって更新されました。

RE: Accessing Liferay translations in FTL

Junior Member 投稿: 70 参加年月日: 16/06/13 最新の投稿
Travis Cory:
Hello Zak,

if you look at the other template files in freemarker you'll see
&lt;@liferay.language key="" /&gt;
where key is the text you want to be translated. You can see more information about the Liferay language properties features on dev.liferary.com https://dev.liferay.com/develop/learning-paths/themes/-/knowledge_base/6-2/creating-language-keys-for-your-theme-settings


Thank you, that worked perfectly.