Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emilymclean/pkl-strings
Generate platform specific string/translation files from a single source file. Currently supports iOS and Android.
https://github.com/emilymclean/pkl-strings
android ios pkl
Last synced: 16 days ago
JSON representation
Generate platform specific string/translation files from a single source file. Currently supports iOS and Android.
- Host: GitHub
- URL: https://github.com/emilymclean/pkl-strings
- Owner: emilymclean
- Created: 2024-04-21T07:00:19.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-11-17T13:04:24.000Z (about 2 months ago)
- Last Synced: 2024-11-17T14:17:39.515Z (about 2 months ago)
- Topics: android, ios, pkl
- Language: Pkl
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pkl-strings
Generate platform specific string/translation files from a single source file. Currently supports iOS and Android.
## Usage
![Stable](https://img.shields.io/github/v/release/BenMMcLean/pkl-strings?label=Stable)
![Preview](https://img.shields.io/github/v/release/BenMMcLean/pkl-strings?label=Preview&include_prereleases)Make a new source file amending `strings.pkl` and override `localizable`:
```pkl
amends "package://emilym.cl/pkl-strings/[email protected]"localizable = new Localizable {
languages = new Listing {
new Language {
code = "en"
strings = new Listing {
new SingleResourceString {
name = "single"
value = "TestValue"
},
new QuantityResourceString {
name = "quantity_positional"
options = new Listing {
new QuantityOption {
quantity = "one"
value = "%d Thing"
}
new QuantityOption {
quantity = "other"
value = "%d Things"
}
}
}
}
}
}
}
```This file can then be exported as an Android `strings.xml` and iOS `Localizable.xcstrings` using the command
```bash
pkl eval file.pkl -m .
```This will automatically render the localized strings into an `android` and `apple` directory for Android strings and iOS strings respectively.