开源软件名称(OpenSource Name):YarikSOffice/lingver开源软件地址(OpenSource Url):https://github.com/YarikSOffice/lingver开源编程语言(OpenSource Language):Kotlin 100.0%开源软件介绍(OpenSource Introduction):LingverLingver is a library to manage your application locale and language. Once you set a desired locale, Lingver will enforce your application to provide correctly localized data via Resources class. The library contains an implementation of the approach described in the following blogpost. SetupThe setup is pretty simple:
Lingver.init(context, defaultLanguage) See the sample app for more customization options.
Lingver.getInstance().setLocale(context, language) Note that you need to update all already fetched locale-based data manually. Lingver is not responsible for that. Follow the system localeYou can configure Lingver to follow the system locale whenever it changes: Lingver.getInstance().setFollowSystemLocale(context) Note that any call to WebViewStarting from Android N, there is a weird side effect while using a WebView in your application. For unknown reasons, the very first creation of it (either programmatically or via inflation) resets an application locale to the system default. Obviously, this is not what we expect to happen. Moreover, it's not going to be fixed anytime in the future according to the issuetracker. That's why we should somehow deal with it on our own. There are plenty of ways how we can fix that, but the idea stays always the same. You have to set back the desired locale after the first usage of a WebView. For instance, you can even programmatically create a fake WebView and immediately set a locale back which prevents this side effect from happening in the future. See an example of implementation in the sample app. App BundlesWhile using an app bundle, a user’s device only downloads string resources that match the one or more languages currently selected in the device’s settings. Refer to this page if you want to change this behavior and have access to additional language resources. Downloadrepositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation "com.github.YarikSOffice:lingver:1.3.0"
} License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论