# Flexi Locale
[](https://github.com/BetterAndroid/FlexiLocale/blob/master/LICENSE)
[](https://github.com/BetterAndroid/FlexiLocale/releases)
[](https://t.me/BetterAndroid)
[](https://t.me/HighCapable_Dev)
[](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
An easy generation Android i18ns string call Gradle plugin.
English | [简体中文](README-zh-CN.md)
|
| [BetterAndroid](https://github.com/BetterAndroid) |
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
This project belongs to the above-mentioned organization, **click the link above to follow this organization** and discover more good projects.
## What's this
This is a Gradle plugin for automatically generating i18ns string calling code functions for Android projects.
In Android projects, to use i18ns string, you need to define them in `strings.xml` and then call them using `context.getString(R.string.xxx)`, which
is very cumbersome and inflexible.
That's why this project was born.
With this plugin, you now only need to instantiate the `AppLocale` class generated by the plugin once, and then you can use it anywhere.
> Traditional Style
```kotlin
val appName = context.getString(R.string.app_name)
```
> Modern Style
```kotlin
val locale by lazy { AppLocale.attach(context) }
val appName = locale.appName
```
If you are still using Java, the writing method remains the same.
```java
var locale = AppLocale.attach(context);
var appName = locale.getAppName();
```
## Compatibility
The theory supports not very old Gradle, the recommended version is `7.x.x` and above.
Android projects containing Kotlin plugins are supported, other types of projects are not supported yet.
> Build Script Language
- Kotlin DSL
It is recommended to use this language as the build script language first, which is also the language currently recommended by Gradle.
- Groovy DSL
Some functions may be incompatible, support will be gradually dropped in the future, and some functions may become unavailable.
## Get Started
- [Click here](docs/guide.md) to view the documentation
## Changelog
- [Click here](docs/changelog.md) to view the historical changelog
## Promotion