Custom Translation
Last updated
Last updated
You can translate the app to your own language if its not listed as one of the supported languages.
Here is how you can translate it yourself.
Go to /lib/constants/app_languages.dart
You will see 3 arrays in the file.
Codes - this is where the language code for each language is saved.
names - the name of the language to be shown to user during language change/selection
flags - the code for the language countries
You can add yours if you want. For example if you want to translate app to Yoruba(A local language in Nigeria). Below is the sample of how the code should look like:
Now Yoruba will be listed as one of the app languages.
After setting your custom language option above, all you are left with is to translate all the used strings used in the app to your custom language.
All translatable strings/values used in the app is grouped inside a translation folder. For example if you want to translate the values on the splash page. Navigate to lib/translations/splash.i18n.dart.
Here is a the content of splash.i18n.dart:
Now you need to set your translated string/value for each object.
Now let us translation the value "Loading Please wait..." to Yoruba. This is how the file would now look like:
That's it, you now have a translated version of that value. You can follow the guide above to translate the rest values in all the translation files.
NOTE: All translation file as an extension of .i18n.dart
Starting from 1.5.0, our apps now uses a different approach for string translation. Translatable strings/words now ends with the .tr() function. All string have been save in a json file in asset folder according to the language code to make it easy to translate work with need strings/words.
For example: if you need to fix a wrong translation in your language, using Spanish for this example. You need to open the es.json file in your assets/lang folder. You will see all the english version of the string and the corresponding Spanish version, you can then edit the spanish version as you like/wish.
E.g en.json is for english, fr.json is for french, ar.json is for arabic etc
You can make the newly added language the default language of the app.
Navigate to lib/services/auth.service.dart. Change the code at line 39. Current code from line 39
To make Yoruba our default language, change the "en" to "yo".
If you need to remove unwanted languages, you can simply comment out the languages you don't want from the /lib/constants/app_languages.dart file