Skip to content

Commit bd077b0

Browse files
Merge pull request #90 from phrase/add_migration_guide
Migration Guide
2 parents addf339 + 0867e6c commit bd077b0

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

MIGRATION.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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()`|

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)