retranslate
Re-translates all views in the given view hierarchy that were automatically translated during layout inflation.
This method walks the view hierarchy and re-applies translations to any views that have stored resource IDs from the TolgeeLayoutInflaterFactory.
Use this after language changes if you prefer not to recreate the Activity. It provides a smoother UX than Activity.recreate() by avoiding the full Activity lifecycle restart.
Example usage:
lifecycleScope.launch {
tolgee.changeFlow.collect {
tolgee.retranslate(this@MainActivity)
}
}Parameters
The root view to start re-translation from (typically content view)
See also
(Activity) For a convenience method that finds the content view automatically
Re-translates all views in the Activity's content view.
This is a convenience method that automatically finds the Activity's content view (android.R.id.content) and re-translates all views in that hierarchy.
Example usage:
lifecycleScope.launch {
tolgee.changeFlow.collect {
tolgee.retranslate(this@MainActivity)
}
}Parameters
The activity whose views should be re-translated
See also
(View) For the base method that accepts a root view