Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vexu/i18n-experiment
An experiment at creating an translation library for use with Zig.
https://github.com/vexu/i18n-experiment
i18n zig
Last synced: 29 days ago
JSON representation
An experiment at creating an translation library for use with Zig.
- Host: GitHub
- URL: https://github.com/vexu/i18n-experiment
- Owner: Vexu
- License: mit
- Created: 2023-05-15T23:14:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-15T09:50:40.000Z (about 1 year ago)
- Last Synced: 2024-10-05T14:47:10.125Z (about 1 month ago)
- Topics: i18n, zig
- Language: Zig
- Homepage:
- Size: 58.6 KB
- Stars: 13
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# i18n experiment
An experiment at creating an translation library for use with Zig.
One goal is that starting to use this should be as easy as
replacing all instances like `writer.print("...", .{...})`
with `i18n.format(writer, "...", .{...})`
where the format string becomes the key for translation.Translations are specified in `$LOCALE.def` files so for code like
```zig
i18n.format(writer, "Hello {s}!", .{name});
```
A finnish translation file `fi_FI.def` would contain something like:
```
# Comment explaining something about this translation
def "Hello {%name}!"
"Moikka {%name}!"
end
```