The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features
See the new ForumsYou need to be logged in to post in the forums. If you do not have an account, please sign up first.
translation extension
Hi,I got a Chrome extension and that use json files as translations. Here i see it is not possible to use direct json as translation. But i recent see that lastpass extension use json translation.
Can anybody know how to load a json message and give it just to a id element in a option.html page (json to javascript).
Or is a other solution to convert my Chrome extension translation json file to make it readable for my Opera extension. (with no change in the json files)
Kind Regards,
Stefan
The most appropriate way to create localised versions of extensions is outlined in this article http://dev.opera.com/articles/view/creating-multilingual-extensions/
Regarding separate json files for translation, I'm afraid I'm not familiar with Chrome's way of doing localisation. It sounds like it should be possible to read it via JS and process it accordingly, but this may need very specific scripting for each case (which is why we have a more generalised localisation model with the Widget packaging method)
Regarding separate json files for translation, I'm afraid I'm not familiar with Chrome's way of doing localisation. It sounds like it should be possible to read it via JS and process it accordingly, but this may need very specific scripting for each case (which is why we have a more generalised localisation model with the Widget packaging method)
I use that already in my config file (for the titel & description).
But i got translations from my www.getlocalization.com project, (where i can download all translation in to a zip file) and there i use json for translation (Chrome need that). Now, i want that Opera also use that translation file, so that my HTML option page in my Opera extension can read this.
And the reference you said, i can't create here +/-25 different option.html page for all my translate languages.
Because if i change or add a option, i must change 25 html page. (and that is much work)
So need a solution to only replace the translation file by file (just like Chrome).
I see that it support "locales is a reserved folder name" that is good for json.
Or do you got a other idea javascript translation, or converteren the json to a other file type that i can use in Opera.... (this will be great
I see that Lastpass extension use json style for translation, it will be great to know how they to that. (also other extension developer would like it the option).
But i got translations from my www.getlocalization.com project, (where i can download all translation in to a zip file) and there i use json for translation (Chrome need that). Now, i want that Opera also use that translation file, so that my HTML option page in my Opera extension can read this.
And the reference you said, i can't create here +/-25 different option.html page for all my translate languages.
Because if i change or add a option, i must change 25 html page. (and that is much work)
So need a solution to only replace the translation file by file (just like Chrome).
I see that it support "locales is a reserved folder name" that is good for json.
Or do you got a other idea javascript translation, or converteren the json to a other file type that i can use in Opera.... (this will be great

I see that Lastpass extension use json style for translation, it will be great to know how they to that. (also other extension developer would like it the option).
You could put the localized translation.json files inside locales and then load the current translation.json from javascript (you just reference it as a normal file relative to extension root folder). Look at the description of the language-matching algorithm in the article above to see how this works.
I'm sure there's multiple libraries for localization from JSON in javascript, or you could write something yourself.
I'm sure there's multiple libraries for localization from JSON in javascript, or you could write something yourself.
Forums » Dev.Opera » Opera Extensions Development Discussions