|
| 1 | +# Phrase Over-the-Air Migration Guide |
| 2 | + |
| 3 | +### Update to v3.11.x+ |
| 4 | +Version 3.11.0 begins the process of removing the Android Context wrapping by Phrase. |
| 5 | + |
| 6 | +Wrapping the Android Context can lead to severe issues with other libraries. E.g. App crashes can occur in combination with WebViews. |
| 7 | + |
| 8 | +#### Suggested Actions: |
| 9 | +- Replace `super.attachBaseContext(Phrase.wrapContext(base))` with `super.attachBaseContext(base)` in your Application class. |
| 10 | +- Replace `Phrase.getDelegate(super.getDelegate())` with `Phrase.getDelegate(super.getDelegate(), wrapContext = false)` in your Activities. |
| 11 | +- Replace Android resource calls with the Phrase equivalents: |
| 12 | + |
| 13 | + |Android Resource Call|Phrase Equivalent| |
| 14 | + |-------------|--------------| |
| 15 | + |`Context.getString()`|`Context.getPhraseString()`| |
| 16 | + |`Context.getText()`|`Context.getPhraseText()`| |
| 17 | + |`Context.getStringArray()`|`Context.getPhraseStringArray()`| |
| 18 | + |`Context.getTextArray()`|`Context.getPhraseTextArray()`| |
| 19 | + |`Context.getQuantityString()`|`Context.getPhraseQuantityString()`| |
| 20 | + |`Context.getQuantityText()`|`Context.getPhraseQuantityText()`| |
| 21 | + |`Resources.getString()`|`Resources.getPhraseString()`| |
| 22 | + |`Resources.getText()`|`Resources.getPhraseText()`| |
| 23 | + |`Resources.getStringArray()`|`Resources.getPhraseStringArray()`| |
| 24 | + |`Resources.getTextArray()`|`Resources.getPhraseTextArray()`| |
| 25 | + |`Resources.getQuantityString()`|`Resources.getPhraseQuantityString()`| |
| 26 | + |`Resources.getQuantityText()`|`Resources.getPhraseQuantityText()`| |
| 27 | + |`TypedArray.getString()`|`TypedArray.getStringWithPhrase()`| |
| 28 | + |`TypedArray.getText()`|`TypedArray.getTextWithPhrase()`| |
| 29 | +- Remove all `Phrase {}` wrapper composable calls if you used Phrase in Compose previously. |
| 30 | +- Use the Phrase calls to retrieve translations in Compose: |
| 31 | + |
| 32 | + |Phrase OTA Composables| |
| 33 | + |-------| |
| 34 | + |`phraseString()`| |
| 35 | + |`phraseText()`| |
| 36 | + |`phraseStringArray()`| |
| 37 | + |`phraseTextArray()`| |
| 38 | + |`phraseQuantityString()`| |
| 39 | + |`phraseQuantityText()`| |
0 commit comments