The challenge was to make an existing project usable in several languages.
The reason I mention it here is that the localization from de to en and fr was relatively easy to make with @Erel 's Localizator concept.
It took only 20 mandays to go over 80.000 lines of code and integrate the translation functions. The Excel list with the key phrases has about 1400 rows. The app consists of over 80 modules and uses over 50 libraries.
The real advantage of "Erel's way" is the very short turnaround time:
Although Google's machine translation might be far from perfect it is free and produces fairly understandable texts. If one decides to get professional translators it will be very easy to send the strings list in an appropriate format. The received data wil be integrated by one single run of the Localizator B4J.
Based on our experience the "Localizator" is the most productive way to localize a large project.
The reason I mention it here is that the localization from de to en and fr was relatively easy to make with @Erel 's Localizator concept.
It took only 20 mandays to go over 80.000 lines of code and integrate the translation functions. The Excel list with the key phrases has about 1400 rows. The app consists of over 80 modules and uses over 50 libraries.
The real advantage of "Erel's way" is the very short turnaround time:
If one phrase was to be added it took only a few steps to append it to the excel list, use the Google Docs SpreadSheets for translation with the really nice plugin "Easy Translations" (thanks, @corwin42) and start the B4J program to get a strings.db directly in the projects Files folder.
If you decide to add another language just let the Excel key column be translated via Google SpreadSheet and copy the result back to your Excel sheet. It takes only -1- run of the B4J program and the app has another language.
If you decide to add another language just let the Excel key column be translated via Google SpreadSheet and copy the result back to your Excel sheet. It takes only -1- run of the B4J program and the app has another language.
Although Google's machine translation might be far from perfect it is free and produces fairly understandable texts. If one decides to get professional translators it will be very easy to send the strings list in an appropriate format. The received data wil be integrated by one single run of the Localizator B4J.
We took a simple Bootstrap webpage and extended the B4J program with the neccessary loc.localize("...") functions:
B4X:
Private Sub BuildWebpages(strLangShort As String, mapLangFoundNatName As Map)
loc.Initialize(File.GetFileParent(txtDB.Text), "", strKeyLanguage, strLangShort)
If strLangShort=strKeyLanguage Then
Dim strOutFile As String = File.Combine(txtPubFolder.Text, "index.html")
Else
Dim strOutFile As String = File.Combine(txtPubFolder.Text, strLangShort & "/index.html")
If Not(File.Exists(strOutFile, "")) Then
ListView1.Items.Add("MakeDir--> " & strOutFile)
File.MakeDir(strOutFile, "")
End If
End If
ListView1.Items.Add(" Create--> " & strOutFile)
File.Delete(strOutFile, "")
Dim strToWrite As String = raGetWebpageIndex(strLangShort, mapLangFoundNatName)
File.WriteString(strOutFile, "", strToWrite)
End Sub
B4X:
Sub raGetWebpageIndex(strLocale As String, mapAvilLang As Map) As String
...
For Each k As String In mapAvilLang.Keys
If k.Length <> 2 Then Continue
If strLocale = strKeyLanguage Then
' All links show simply down --> \en\index.html
If k = strKeyLanguage Then ' de
sb.Append($"<a href="index.html">${mapAvilLang.Get(k)}</a>"$)
Else
sb.Append($"<a href="${k}/index.html">${mapAvilLang.Get(k)}</a>"$)
End If
Else
' All links show one level up an then down --> ..\en\index.html
If k = strKeyLanguage Then ' de
sb.Append($"<a href="../index.html">${mapAvilLang.Get(k)}</a>"$)
Else
sb.Append($"<a href="../${k}/index.html">${mapAvilLang.Get(k)}</a>"$)
End If
End If
If intS < mapAvilLang.Size -1 Then
sb.Append(" ~ ")
End If
intS = intS +1
Next
Dim strLangSwitcher As String = sb.ToString
'
Dim strHtml As String = $"
<!DOCTYPE html>
...
<!-- Jumbotron -->
<header class="jumbotron" role="banner">
<div class="container">
<div class="row">
<div class="col-md-5">
<h1>besonavi</h1>
<!-- Logo -->
<figure class="text-center">
<a href="./index.html">
<img class="img-logo" src="images/logo.png" alt="">
</a>
</figure>
<!-- /.text-center -->
<!-- Language switcher -->
${strLangSwitcher}
<!-- /Language switcher -->
<!-- Title -->
<h1>${loc.localize("Koma-Reisen! Schlafen von Abfahrt bis Ankunft.")}</h1>
<!-- Sub title -->
<p>${loc.localize("Eben noch auf dem Sofa - nun bereits am Strand")}</p>
<!-- Button -->
<p class="btn-app-store">
<a class="btn btn-link" href="https://play.google.com/store/apps/details?id=com.yourcomp.app1&hl=${strLocale}">
<img src="images/google-play-badge.png" alt="">
</a>
</p>
<!-- /.btn-app-store -->
</div>
<!-- /.col-md-7 -->
<div class="col-md-7">
<!-- Images showcase -->
<figure>
<img class="img-android" src="images/android/1.jpg" alt="">
</figure>
</div>
<!-- /.col-md-5 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</header>
<!-- /.jumbotron -->
...
"$
...
Return strHtml
End Sub
Based on our experience the "Localizator" is the most productive way to localize a large project.
Last edited: