Internationalisation - I18n
This section is about how we can define localised content in the context of the Mealz SDK.
By default, Mealz supports two languages: English and French
Override Mealz SDK values
Strings
Let's assume that the Mealz SDK embeds the following localisation string:
<resources>
<string name="com_miam_i18n_recipe_add">Add ingredients</string>
</resources>
On Android, it is fairly simple to override resources that come from our library. Just declare values with the same identifier, and it's done.
In your application, just add the following string declaration inside a res/values(-LANG)/<FILENAME>.xml (the filename doesn't matter) to override it:
<resources>
<string name="com_miam_i18n_recipe_add">Add recipe to basket</string>
</resources>
Plurals
Let's assume that the Mealz SDK embed the following localisation string:
<resources>
<plural name="com_miam_basket_product">
<item quantity="one">%d article</item>
<item quantity="other">%d articles</item>
</plural>
</resources>
On Android, it is fairly simple to override resources that come from our library. Just declare values with the same identifier, and it's done.
In your application, just add the following plural declaration inside a res/values(-LANG)/<FILENAME>.xml (the filename doesn't matter) to override it:
<resources>
<plural name="com_miam_basket_product">
<item quantity="one">%d item</item>
<item quantity="other">%d items</item>
</plural>
</resources>
When consuming com_miam_i18n_recipe_add, you should see Add recipe to basket instead of Add ingredients.
When consuming com_miam_basket_product, you should see 1 item & 2 items instead of 1 article & 2 articles.