igorfs10 / rust_hero

Um jogo simples em rust
GNU General Public License v3.0
4 stars 1 forks source link

Other language support in UI #8

Open 1sra3l opened 3 years ago

1sra3l commented 3 years ago

We can easily translate the FLUID side of things because of the effort of Mr Alyousef via the tr crate. Inside our code it is easy to quickly implement. Simple replace all strings to translate as tr!("item") OR tr!("context_for_reused_word"=>"item") This will be pretty easy to do in the code part, I think.

We could probably just use the command line tool gettext since this is based on gettext anyhow. Have you ever set up for translations before? If you are already setup, and know what to do, feel free to tackle this first!

We will need to think about how to cross platform directory search/store the locale files, though

Also, ALL error messages should be in English, that way if it is used in a language neither of us know, it will be a message we can both read!

igorfs10 commented 3 years ago

I was thinking to create a file with a list of language files that will be loaded in a struct and just set text to elements, but as it has tr support I will look at tr and gettext, it's probably easier than the way I was thinking. I never made translation before, so I dont know if the way I was thinking is good.

1sra3l commented 3 years ago

From my experiences gettext is pretty widespread. When checking out tr it seemed like a nice simple macro. You need to initialize it to the directory where things are stored. Two options here:

Either solution is fine to me.