An open API service indexing awesome lists of open source software.

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

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.
```swift

import 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.