B4A Library lmTranslation

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".
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 :D).

[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 Luca.Messina70@Virgilio.it
 
Last edited:

ArminKH

Well-Known Member
thank u luca
is this possibleto use txt databases?it seems very helpful
 

ArminKH

Well-Known Member
You can import CVS text files into lmTranslationDBManager, @ArminKH

Write me an email, I will send you them for free.
no thank u
if i want to use your lib then i prefer to bought it
your time and your hard work is valuable more than just 15 €
however for now there is not any way to donate with paypal or visa , etc in my country
any way thank you,i never forgot your past message in above ;)
 

M.LAZ

Active Member
Licensed User
Longtime User
very nice lib,, i got it last year.. is there any updates or does it support B4I?
 
Top