cancel
Showing results for 
Search instead for 
Did you mean: 

Getting I18N string from alfresco webscripts

vladislavlysov
Champ in-the-making
Champ in-the-making
Hello!
  I have a question. It's a very simple, but I'm not found solution in wiki and forum. I have .property file with I18N string and webscript in alfresco(not in share). How to get I18N string from webscript? Share and ftl have a ways to do it, but alfresco webscript no?
Thank you.
4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator
Hello,

the mechanism is AFAIK the same for Repository and Share web scripts, so you should only need to locate/name your .properties file according to the web script package and id, and you should be good to go. Could you provide an overview of your web script resources so we might check if some convention is not properly adhered to?

Regards
Axel

vladislavlysov
Champ in-the-making
Champ in-the-making
Yes. My webscript is "sample.get.json.js" and property file "sample.get.json.properties" with string "sample=sample". I don't found solution for my problem. If you knw, please, show example code or function for getting i18n string from javascript webscript.
Thank you.

afaust
Legendary Innovator
Legendary Innovator
Hello,

your properties file should be called "sample.get.properties", not "sample.get.json.properties". This is based on your web script whose id is "<package>.sample.get". Those json / html / xml parts in FreeMarker or JavaScript files are just for differentiating different format handlers of the same web script. Properties files are not format specific and thus do not contain these additional identifiers.

Try it and let us know if it helps…

Regards
Axel

vladislavlysov
Champ in-the-making
Champ in-the-making
Ouu! Thank you!!! I'm try to rename my properties file to "sample.get.properties" and from javascript getting I18N string with next code:

msg.get("sample");
My problem is solved, big thank you!