Jump to content

resourcestrings ... how to use them?

Recommended Posts



how to use resourcestring to create multi-language apps? I know that I can declare a resourcestring variable in SMS, and that resourcestring is included in the html file als array $R. But the strings are included in the html file in the language I defined it in the code.



  RS_Save = 'Save';


var $R = ['Save', ...]


I also saw, that I can export the resourcestrings as json file, but for what reason?

So how can I change the language in my app using resourcestring?



Share this post

Link to post
Share on other sites

Currently, this feature is not fully implemented. We started support for this (hence the export to JSON), but didn't implement it fully. However, as you already noticed the resource strings are identified by $R, so it's pretty easy to update this variable with data coming from a JSON file by yourself.


Once you have the JSON file (for one language) you can alter its values to any other language. Then, when the application has been loaded you have to load the JSON file for the language of choice as well and replace the current values of $R by this.


If not limited in time today, I could write some example code, but it's straight forward. The only problem with this approach is the fact that if you add more variables you have to adapt your JSON files as well. This might be cumbersome in the long run. So hopefully a little support by the IDE will get implemented sooner or later.


What's high on the list is (Eric's suggestions to this topic):

  • be able to specify gnutgettext dictionaries at the project level
  • be able to populate/update the dictionaries from the resource strings
  • during compilation generate json files with localized strings (using the dictionaries)
  • maybe be able to mark of form as localizable, it would then use resourcestrings in its auto-generated code rather than simple strings
While these plans have been made, there is currently no roadmap for this part.


Personally, I don't use/need localization so far, thus there's no motivation for me to implement it. But I can only speak for myself here and only for now. It might surely change in the future.

Share this post

Link to post
Share on other sites

Thanks for the quick reply. Currently the main language of my app is german, but it would be great to have an english version in the future. So, I need to decide, how to implement it, in order swtiching language would be easy in the future. If you could address that feature in the next year or so, that would be sufficient for me.

More important to me is the code completion / createn and navigation functionality, as I already posted.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now