The instructions for internationalizating a template tell you to update the ResourceBundle.tmx file. That’s all they tell you to do. They don’t even say to restart. Is that really all you have to do to translate static text in a template? I’m surprised that you don’t have to do anything in the actual template (aside from set the $locale variable in the binding).
Anyway, I tried it (although, I did restart), and I am not seeing any results. Any tips on what else I can try? Here is what I did:
Updated the rxconfig/I18N/ResourceBundle.tmx file with this:
<tu tuid="velocity.cnProductIndex_GlobalTemplate@All">
<prop type="sectionname" xml:lang="en-us">XSL Stylesheet</prop>
<note xml:lang="en-us">The label for a link to all items</note>
<tuv xml:lang="en-us">
<seg>All</seg>
</tuv>
<tuv xml:lang="ja-jp">
<seg>All in Japanese</seg>
</tuv>
</tu>
Set the $locale = $sys.item.getProperty(“sys_lang”) in the bindings.
Restarted the server.
Changed to the Japanese domain and previewed a Japanese translation of an item, with a template that uses the above global template.
Still just seeing ‘All’. Which doesn’t surprise me so much. It seems like I must be missing a step.
Probably something to do with the “namespace” of the “All” keyword. I don’t know what it should be off the top of my head: some more research will be required.
In the TMX file, you have defined the key as “velocity.cnProductIndex_GlobalTemplate@All”
I’m not sure whether this is the correct prefix, and if it is, how much of it needs to be specified in the JEXL expression… I’ll have to run some tests and look further into the code/documentation of these methods.
[QUOTE=dbenua;6197]I would not have expected it to
In the TMX file, you have defined the key as “velocity.cnProductIndex_GlobalTemplate@All”
I’m not sure whether this is the correct prefix, and if it is, how much of it needs to be specified in the JEXL expression… I’ll have to run some tests and look further into the code/documentation of these methods.[/QUOTE]
Thanks for looking into it.
I should have been more clear: I tried this:
<tu tuid="velocity.cnProductIndex_GlobalTemplate@Betty">
<prop type="sectionname" xml:lang="en-us">XSL Stylesheet</prop>
<note xml:lang="en-us">The label for a link to all items</note>
<tuv xml:lang="en-us">
<seg>Betty</seg>
</tuv>
<tuv xml:lang="ja-jp">
<seg>Betty in Japanese</seg>
</tuv>
</tu>
Dave was on the right track. You need to provide the entire key in the $rx.i18n.getString method: e.g. $rx.i18n.getString(“velocity.cnProductIndex_GlobalTemplate@Betty”, “ja-jp”)
You don’t have to restart to pick up changes in the tmx file, you just have to use the “reload i18nresources” console command.
Actually, your last suggestion worked. I had another, unrelated issue that was effecting it.
I recently moved my rhythmyx root to another disk. I simply copied it over there. And that seemed to work fine. But it is still using the rxconfig files that are in the original location. So I needed to update the ResourceBundle.tmx file over there.
P.S. I went back to using the original root. It’s just for development on my own desktop, but obviously I was risking some problems by moving my root directory.
Does this work if the keys (static text) is inside macro in an assembly file. I tried everything but it doesnt seem to work for me.
I have a snippet template rfh_Sn_TitleAuthorDateLink which calls the macro rfh_posted_on which takes locale as the parameter. The macro is in rfh_assembly.vm file. So this is what I have