Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
B3nedikt authored Feb 20, 2023
1 parent f8fb137 commit 5f153ba
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ implementation 'dev.b3nedikt.restring:restring:5.2.2'
implementation 'dev.b3nedikt.viewpump:viewpump:4.0.10'
// Allows to update the text of views at runtime without recreating the activity
implementation 'dev.b3nedikt.reword:reword:4.0.3'
implementation 'dev.b3nedikt.reword:reword:4.0.4'
```

### 2. Initialize
Expand All @@ -32,6 +32,21 @@ ViewPump.init(RewordInterceptor)

### 3. Inject into Context

If you use your application `Context` to retrieve string resources add the following to your
`Application` class:

```kotlin
class SampleApplication : Application() {

...

override fun getResources(): Resources {
return AppLocale.wrapResources(applicationContext, super.getResources())
}
}
```


If you have a BaseActivity you can add this there, otherwise you have to add it to all of your activities:

```kotlin
Expand All @@ -51,10 +66,6 @@ abstract class BaseActivity : AppCompatActivity() {
}
```

Also should you use the application context somewhere to retrieve strings
and inject it with a DI tool like koin or dagger, I would recommend wrapping it in your
application class with Restring.wrap(...) when providing it to your DI tool.

### 4. Provide new Strings

Now load your strings like this:
Expand Down

0 comments on commit 5f153ba

Please sign in to comment.