Open rcoreilly opened 6 years ago
This is the standard library for doing this in go: https://godoc.org/golang.org/x/text/message
This should probably be implemented through an automatic translation on Label
, as that would be much easier for people and require no significant breaking changes. Some basic automatic translation generator CLI (as a goki translate
command) built on Google Translate or something similar with the option to add custom translations for things would be good. This would allow people to generate basic translations and then make things fully correct if they have the resources to do so. A global map of maps (the first with language name keys and the second with the words/phrases used in the code as keys) is probably the easiest way to implement this. The user's preferred language would be stored in gi.Prefs, and it would default to the system language. Translation shouldn't be too difficult to implement a basic version of, so it should be a relatively high priority.
Qt requires you to wrap all use of string literals in some magic cookie, in Go it would be something like:
tr.Tr("Ok")
?But might be simpler to just have
Label
directly take responsibility for translating everything it gets, with a "translate" property that gets set to true by default, but can be turned off? All fixed-content gui elements go throughLabel
eventually so probably that makes sense, and is more automatic and clean.is there any existing Go infrastructure that would be helpful for this?
impl can simply be a big map of maps or something like that. need to deal with asset issues for the translation database, etc #8