Skip to content

Commit 3e7db9a

Browse files
add_migration_guide: add a migration guide to the documentation
1 parent 3a2f20b commit 3e7db9a

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

MIGRATION.md

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

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class MainApplication : Application {
5151
}
5252
```
5353

54+
### Update to a new Version
55+
When updating the Phrase OTA SDK, please check the [migration guide](MIGRATION.md) if you need or should adapt your code to the changes.
56+
5457
### Jetpack Compose Support
5558
Use Phrase provided composables to get the translations: `phraseString(R.string.translation_key)`.
5659

0 commit comments

Comments
 (0)