Is there a recommended program for creating and managing language resource files?
I don’t know about any SketchUp/Ruby developer uses a dedicated software (they are just plain text files), although it would be good.
Usually misfitting translations result from that it is not clear in what context a string is used. It’s good to track related information with comments. It’s also important to be careful when ever modifying the string in the Ruby source code. And it is important to have a “dictionary” of the technical terms that SketchUp uses and existing translations.
On SketchUcation we were discussing once whether to setup a public/community Pootle for managing/contributing translations.
I could create the string files manually, and I see examples of what they look like from other extensions I’ve downloaded from in the warehouse. But what are the conventions for naming the files and folders for adding other languages?
I see some extensions with separate folders for each language, others with the language name as part of the filename. I just don’t understand how langhandler.rb knows which file to use for a given user.
I picks the language matching the current SketchUp locale. And the folder structure must the exactly as the docs describe it, otherwise it won’t be found: Homepage | SketchUp Developer
If you want to support other languages than what SketchUp support you need to roll your own localizing.
If you are looking for a base implementation for that you can look at the Babelfish class I’ve used in some of my own extensions that needed some extra features which LanguageHandler didn’t have (plus LanguageHandler wasn’t included into the API until recently.)
https://bitbucket.org/thomthom/tt-library-2/src/47e8ff82ba20190e75b46412a180b254e27b5311/TT_Lib2/babelfish.rb?at=Version%202.9
Thanks, that’s helpful.
You say “If you want to support other languages than what SketchUp supports …”
I don’t. but how can I tell what Sketchup supports? I see only an “en” resource folder in program files.
I want to point to Sketchup.get_locale
- but I’m not sure if that is up to date.
http://www.sketchup.com/intl/en/developer/docs/ourdoc/sketchup#get_locale
@Tommy - do we have a current list somewhere of the languages supported by SketchUp?
SketchUp’s own LanguageHandler requires the folder structure. It makes sense considering that there could potentially be more resources that require localization (images, skp, html without JavaScript based translation). The majority of simple scripts may get around without further resources.
(Hm, I still don’t understand why LanguageHandler was made part of the API without a final consulting with the Ruby developers. As part of the API, it’s unlikely to ever change.)
SketchUp supports the languages that the executable is available in. The downloads each ship only one language (+English), but are otherwise mostly identical. Each language just brings its own subfolder in SketchUp ##/resources/
. (There used to be also SU8 in ru
and nl
). With Sketchup.get_locale
you can obtain the current language used by SketchUp. It can only be one of these, if your operating system is set in a different language, SketchUp’s API method only returns a locale supported by SketchUp (usually fallback to en-US
).
Fun fact: With a start-up parameter -lang=fr
the locale can be overriden with whatever string you like – even pfl
– and it would then look for a pfl
folder.
Yea - I don’t like the current implementation either. Should have been cleaned up. It was API-ified before I started.
Note that Download All | SketchUp
shows a different list than
http://help.sketchup.com/en/article/2542817
The first governs but the second mentions russian and dutch which don’t seem to have download links?
The Knowledge Center article is, unfortunately, inaccurate. I will get that fixed straight away. Russian and Dutch were available up to SketchUp 8. SketchUp 2013 to 2015 (to date) only have localized versions in these ten languages:
- English
- French
- Italian
- German
- Spanish
- Brazilian Portuguese
- Korean
- Japanese
- Chinese (Simplified)
- Chinese (Traditional)