Translation Strings

11 views
Skip to first unread message

No One

unread,
Mar 18, 2022, 1:08:54 AMMar 18
to Developing Interactive Simulations in HTML5
Where can I find the translation strings of the projects?

cmalley

unread,
Mar 18, 2022, 9:47:51 AMMar 18
to Developing Interactive Simulations in HTML5
There are translated strings associated with simulation repositories and common-code (library) repositories. Strings for the English locale ("en") live at the top-level of the repository, for example: geometric-optics-strings_en.json, scenery-phet-strings_en.json.  

After making changes to the English strings file, note that you need to run "grunt modulify" in the repository to regenerate the js/*String.ts file for the repository (e.g. geometric-optics/js/geometricOpticsStrings.ts ,scenery-phet/js/sceneryPhetStrings.js).  These *Strings.ts files are how you import strings into code, for example:

import geometricOpticsStrings from '../../geometricOpticsStrings.js';
...
const helloWorldNode = new Text( geometricOpticsStrings.hellowWorld, ... );

Strings for other locales lives in the babel repository, and have a json format that is identical to the English files. These files are not typically created directly by developers.  They are created by translators, using PhET's Rosetta translation tool - more info at https://phet.colorado.edu/en/for-translators.

Does that answer your question?

Chris Malley
PixelZoom, Inc.

Reply all
Reply to author
Forward
0 new messages