java - How to load component-specific resource bundle for translation? -


i followed instructions on page (http://docs.adobe.com/docs/en/cq/current/developing/cq5-translator.html) in order try give component access translatable string bundle. followed these instructions (http://www.wemblog.com/2011/12/how-to-use-multi-language-translation.html) setup component's jsp file use translated strings. however, it's not working; default value used. i'm not sure attempting pull resource bundle from, pull i18n folder i've created directly under component node. ideas doing wrong?

relevant jsp code:

<cq:setcontentbundle language="se" source="static" /><% locale pagelocale = currentpage.getlanguage(false);  resourcebundle resourcebundle = slingrequest.getresourcebundle("hello-world-strings", pagelocale);     i18n i18n = new i18n(resourcebundle); %>  <div style="margin:1em;padding:.8em;box-shadow:inset 0px 0px .5em #ddd;border:solid 1px #aaa;">     <h1>translation testing output</h1>     out: <%= i18n.get("name") %> </div> 

adding comment in cq's translator changes key. debugging, try spitting keys out:

<%= slingrequest.getresourcebundle(slingrequest.getlocale()).keyset()%><br> 

if see keys in list have unexpected double parentheses, translator comments. if case, may not getting messages because keys aren't think should be. try deleting comments. can't in translator, can use tool crxde edit sling:key property directly.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -