Android Code Snippet Simple Multilanguage Rotine

Simple translate rotines

I develop a simple rotine to translate language using text file like "NotePad"

The example translate from Português to English and português has special characaters

To start
- run in debug mode so you can set a button to call "trans.generate" after the first steps
- Even if you don´t have any translate file you must inicialize "trans.initialize ( filename )"
- Then every text you add the call before the text "trans.translate ( "some texto")
- The software will run normally and will building the map to translate
- run every message and panel from your app and clear the log and press the button "generate" to call "generate_txt" so in the log windows you can copy all and paste to a text file edit with "NotePad"
( I use the Notepad ++ )
- this will be the default language file like "lang.pt"
- We define "=" ( equal sign) as the separator but you can change to other character
- copy the file to start translating to other language and change the right side after "=" in the file and a new name
- The text files must be inside the to "File" directory

Then try to run your software initializing wit the new language.
You can run your app and if there is any ortion that was not included in the file when you press the button "generate" just the news one will appear and you can copy and psast to the text file to trabslate
 

Attachments

  • TranslateHSP.zip
    372.8 KB · Views: 293
Top