The most useful way to use this library is to use it along with lmTranslationDBManager app.
[EDIT: Very important addition, thanks to @maxware's suggestion: added method Tr2, which will translate all texts in an Activity or Panel, so you don't need to write many lines of code and, ALSO, you can add translations to your old projects.
Just one code line: Translation.Tr2(Activity, True).
See post #10]
Each language you add to your app could do double (probably ten times) the downloads of your apps.
This library allows you to easily and quickly add translations to your apps.
You could also use it along with lmTranslationDBManager, making your work even easier.
How you should work with this library (very easy):
"Inizialize" the library with the languages code you want your app "speaks".
You can add other languages later, of course.
Add first the language that you use to develop. Above I set "en" - English, then I will use English to write my texts in my app, but I could choose any other language.
Then, simpy write your texts this way:
instead of
you should simply write:
At runtime, the library will search those texts in the db it created and it will replace them with their translations in the current language set on the device.
If lmTranslation does not find the translation, it would use the developing language (English, in this example).
So, you will have a db table similar to the above:
Now, you should add the italian and french translations:
You could do it manually, using some tool like SQLite Personal 3, for example.
But, MORE EASILY, you could use lmTranslationDBManager, an app expressly created to manage this database, which allows you to use Google Translate to translate your texts quickly and easily.
Take a look at lmTranslationDBManager.
App (lmTranslationDBManger) and library (lmTranslation) are not free (they can seem simple to develop but, as alway, the work was greater than expected).
You can donate (for both) an amount between 10 and 20 Euros, depending on how much you think you are generous (or depending on how much rich you are ).
[EDIT: The price (lib+app) is now 15 € (or 6€ - 9€)]
If you want the library only... divide the amount in half
To receive these softwares, you can contact me at [email protected]
[EDIT: Very important addition, thanks to @maxware's suggestion: added method Tr2, which will translate all texts in an Activity or Panel, so you don't need to write many lines of code and, ALSO, you can add translations to your old projects.
Just one code line: Translation.Tr2(Activity, True).
See post #10]
Each language you add to your app could do double (probably ten times) the downloads of your apps.
This library allows you to easily and quickly add translations to your apps.
You could also use it along with lmTranslationDBManager, making your work even easier.
How you should work with this library (very easy):
"Inizialize" the library with the languages code you want your app "speaks".
B4X:
Dim lstLanguages As List : lstLanguages.Initialize
lstLanguages.Add("en") ' <--- developing languages
lstLanguages.Add("it") ' <--- first translation language
lstLanguages.Add("fr") ' <--- second translation language
'...
Translation.Init(File.DirDefaultExternal, "Translation.db", lstLanguages, True)
You can add other languages later, of course.
Add first the language that you use to develop. Above I set "en" - English, then I will use English to write my texts in my app, but I could choose any other language.
Then, simpy write your texts this way:
instead of
B4X:
bntOpen.Text = "Open"
MsgBox("Please, enter your name", "Log in")
you should simply write:
B4X:
bntOpen.Text = Translation.Tr("Open")
MsgBox(Translation.Tr("Please, enter your name", "Log in"))
At runtime, the library will search those texts in the db it created and it will replace them with their translations in the current language set on the device.
If lmTranslation does not find the translation, it would use the developing language (English, in this example).
So, you will have a db table similar to the above:
B4X:
'en it fr
' Open
' Please, enter your name
' Log in
Now, you should add the italian and french translations:
B4X:
'en it fr
'Open Apri Ouvrez
'Please, enter your name Per favore, immetti il tuo nome S'il vous plaît, entrez votre nom
'Log in Accedi Connectez-vous (I'm not so sure ^_^)
You could do it manually, using some tool like SQLite Personal 3, for example.
But, MORE EASILY, you could use lmTranslationDBManager, an app expressly created to manage this database, which allows you to use Google Translate to translate your texts quickly and easily.
Take a look at lmTranslationDBManager.
App (lmTranslationDBManger) and library (lmTranslation) are not free (they can seem simple to develop but, as alway, the work was greater than expected).
You can donate (for both) an amount between 10 and 20 Euros, depending on how much you think you are generous (or depending on how much rich you are ).
[EDIT: The price (lib+app) is now 15 € (or 6€ - 9€)]
If you want the library only... divide the amount in half
To receive these softwares, you can contact me at [email protected]
Last edited: