Skip to content

Commit

Permalink
add translation doc
Browse files Browse the repository at this point in the history
  • Loading branch information
fralonra committed Dec 3, 2023
1 parent c07b4d5 commit 9089459
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ You can find examples in [wgs's repo](https://github.com/fralonra/wgs/tree/maste
- The amount of the texture you can upload is [the max bind group count of your device](https://docs.rs/wgpu/latest/wgpu/struct.Limits.html#structfield.max_bind_groups) - 1.
- Won't show any hints on invalid shaders. They just won't compile.

## Todos
## Contributing

- Web version
- Advanced shader validation (detailed in https://github.com/fralonra/wgshadertoy/issues/1)
- [Translations](./i18n/README.md)

## Credits

Expand Down
19 changes: 19 additions & 0 deletions i18n/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translations

WgShadertoy uses [Fluent](https://projectfluent.org/) as the localization framework. If you are not familiar with it, we recommend that you read the Fluent documentation first.

## Edit Existing Translation

If you find a translation error (very likely), please help us improve it.

All translation files locate in the [`i18n`](https://github.com/fralonra/wgshadertoy/tree/master/i18n) folder. Please find the corresponding folder according to the [ISO 639 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), open the `wgshadertoy.ftl` file inside, modify the text, and then submit a PR. Thank you!

## Add A New Language

If you want to add a new language, please create a new folder in the `i18n` folder, named after the [ISO code of the language](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), copy the [`wgshadertoy.ftl`](https://github.com/fralonra/wgshadertoy/blob/master/i18n/en/wgshadertoy.ftl) file in the `i18n/en` folder to this new folder, and modify it.

Next, you need to find the `LANGUAGES` constant in the [`src/i18n.rs`](https://github.com/fralonra/wgshadertoy/blob/master/src/i18n.rs) file and add the information of the new language properly.

If the new language uses a non-common writing system, the program may not be able to render the text correctly. You should open the [`src/fonts.rs`](https://github.com/fralonra/wgshadertoy/blob/master/src/fonts.rs) file and add the corresponding [writing system](https://en.wikipedia.org/wiki/Script_(Unicode)) and its common fonts in the `FONTS_MAP` constant.

After everything is done, submit a PR. 🍺!
2 changes: 1 addition & 1 deletion src/fonts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::fs::read;
// allowing them to load first to reduce the total number of fonts loaded.
//
// If you find that a certain language cannot be displayed
// correctly on your device, please submit feedback: https://github.com/fralonra/wgshadertoy/issues/7
// correctly on your device, please submit feedback: https://github.com/fralonra/wgshadertoy/issues/7
const FONTS_MAP: [(&str, &[&str]); 4] = [
(
"Arabic",
Expand Down

0 comments on commit 9089459

Please sign in to comment.