3.0.0
Breaking Changes
Method overwriting
In previous versions it was neccessary to overwrite attachBaseContext in the activity. This is no longer required and changed to:
@NonNull
@Override
public AppCompatDelegate getDelegate() {
return Phrase.getDelegate(this, super.getDelegate());
}Caching behavior
The caching of fetched locales changed. This means that the cache from previous versions of the app will not be used and the latest translations will fetched during the first start of the app.
Added
- Classes inheriting from
Applicationshould overwriteattachBaseContextto enable translations outside of the activity context:
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(Phrase.wrapApplicationContext(newBase));
}- Support plural translations
- Support translation of inflatable menus
Switching languages during runtime
Added Phrase.setLocaleCode(localeCode) to change languages during runtime.
Example for switching the language during runtime:
Phrase.setLocaleCode("fr");
Phrase.updateTranslations();
recreate();Fixed
- Improve appcompat compatibility
- Fix webview crash #20
- Fix rare case where translation could not be loaded from cache
Compatibility
With version 3.0.0 the SDK requires at least appcompat version 1.2.0