https://github.com/t-osawa-009/localizedstringkeygen
https://github.com/t-osawa-009/localizedstringkeygen
generate generator ios localization localizedstringkey strings swift swiftui
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/t-osawa-009/localizedstringkeygen
- Owner: t-osawa-009
- License: mit
- Created: 2020-06-11T23:49:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-16T15:55:31.000Z (almost 5 years ago)
- Last Synced: 2025-01-10T12:50:00.125Z (4 months ago)
- Topics: generate, generator, ios, localization, localizedstringkey, strings, swift, swiftui
- Language: Swift
- Size: 12.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# LocalizedStringKeyGen
Tool to generate a LocalizedStringKey
## Installation
### Makefile
```sh
$ git clone [email protected]:t-osawa-009/LocalizedStringKeyGen.git
$ cd LocalizedStringKeyGen
$ make install
```### [Mint](https://github.com/yonaskolb/Mint)
```sh
$ brew install mint
$ mint install t-osawa-009/LocalizedStringKeyGen
```## Usage
1. Prepare the original data, Localizable.strings.
```
"hoge"="hoge";"foo"="foo";
"bar"="bar";
```2. Added `.LocalizedStringKeyGen.yml` to set the generation method.
```yml
outputs:
- enumName: Strings
output: Strings/Localizable.swift
sort: asc
publicAccess: true
```3. Execute the command.
```sh
$ LocalizedStringKeyGen --localize_path Localizable.strings
```
4. The swift file is generated.
```swiftimport SwiftUI
public enum Strings {
public static var bar: LocalizedStringKey { return "bar"}
public static var foo: LocalizedStringKey { return "foo"}
public static var hoge: LocalizedStringKey { return "hoge"}
}
```## Configuration
- You can customize the way files are generated by setting the `.LocalizedStringKeyGen.yml`.
- `enumName` enum name
- `output` File generation path
- `sort` (optional) asc or desc
- `publicAccess` (optional) Public Access```yml
outputs:
- enumName: Strings
output: Strings/Localizable.swift
sort: asc
publicAccess: true
```## CONTRIBUTING
- There's still a lot of work to do here. We would love to see you involved. You can find all the details on how to get started in the Contributing Guide.## License
LocalizedStringKeyGen is released under the MIT license. See LICENSE for details.