Skip to content

Reword is a android library to update the texts of views when the apps texts have changed due to a language change or an update of the apps string resources.

License

Notifications You must be signed in to change notification settings

B3nedikt/reword

Repository files navigation

Maven Central Build & Test codecov javadoc

Reword 4.0.4

Reword is a library to update the texts of views when the apps texts have changed due to a language change or an update of the apps string resources with a lib like Restring or AppLocale.

1. Add dependency

// Intercept view inflation
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.4'

2. Initialize

Initialize Reword in your Application class:

ViewPump.init(RewordInterceptor.INSTANCE);

3. Update some views

For example update all views in the current activity:

Reword.setLocale(Locales.FRENCH);

// The layout containing the views you want to localize
final View rootView = getWindow().getDecorView().findViewById(android.R.id.content);
Reword.reword(rootView);

Custom Views

This library supports many common android views out of the box. If you need to support custom views only used by your app, you can however do it like this:

Reword.addViewTransformer(new YourCustomViewTransformer())

See the TextViewViewTransformer as an example how a ViewTransformer implementation should look like.

License

This library takes some inspiration from the library "restring" originally developed by Hamid Gharehdaghi, as well as the library "Philology" by JcMinarro.

Copyright 2019-present Reword Contributors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Reword is a android library to update the texts of views when the apps texts have changed due to a language change or an update of the apps string resources.

Resources

License

Stars

Watchers

Forks

Packages

No packages published