Closed 1sra3l closed 3 years ago
I'm busy now but I will try to compile and merge the pr later today. I will let the help button for now, but in the future when implementing localization it will be changed to settings. As there are some dynamic texts I think will be better to create localization manually or with a localization library. Thanks for all your help.
I don't know much about localization in Rust yet. I had thought to make an ini
file similar to how .desktop
files localize things, because I already have code to read that :smile:
You could also save the Weapon/Item/Character data in the ini format with localization
[None]
# You could default to the header if no localization exists
name[en]=None
name[pt]=Nenhum
attack=0
defense=0
[Sword]
name=Sword
attack=3
defense=1
[Shield]
name[en]=Shield
attack=1
defense=3
[Spear]
name[en]=Spear
attack=2
defense=2
I use tini
crate for ini, it is very fast, and works very well for me.
I suppose the same could be done for FLTK, but I think there may be a better way to do things
@igorfs10 Good news, I talked to the maintainer and he said it would not be hard to do, since the C++ uses gettext macros, he could swap them out for some Rust i18n crate with macros! So generating the pot file and making po translation files should be easy. Exciting news!
One other thing, I think drawing a segment of a picture is supported via fltk::image::Image::draw(x,y,w,h) similar to the C++ libs. So if you wanted minor animations you could use a custom handle
function. I will experiment with this a bit on my own.
I don't know much about localization in Rust yet. I had thought to make an
ini
file similar to how.desktop
files localize things, because I already have code to read that 😄 You could also save the Weapon/Item/Character data in the ini format with localization[None] # You could default to the header if no localization exists name[en]=None name[pt]=Nenhum attack=0 defense=0 [Sword] name=Sword attack=3 defense=1 [Shield] name[en]=Shield attack=1 defense=3 [Spear] name[en]=Spear attack=2 defense=2
I use
tini
crate for ini, it is very fast, and works very well for me.I suppose the same could be done for FLTK, but I think there may be a better way to do things
Great idea. I was thinking to use Gjson which works the same way as tini but for json files. Ini is better in this case as it's is cleaner for localization. It's possible to put data in files, but I need to think better about it, maybe we can use json files to make a more dynamic system as it supports arrays, after that we can just use json files to add new things.
One other thing, I think drawing a segment of a picture is supported via fltk::image::Image::draw(x,y,w,h) similar to the C++ libs. So if you wanted minor animations you could use a custom
handle
function. I will experiment with this a bit on my own.
Thanks for the tip, I will take a look.
I am trying to find out if localization can be done using fl2rust, and setting one of the options for it in FLUID's settings. Obviously we will need to support multiple languages for the display. the "Help" button may need to be re-named "Settings"