adventuregamestudio / ags

AGS editor and engine source code
Other
695 stars 159 forks source link

Feature request: Support for editor localization #1043

Open persn opened 4 years ago

persn commented 4 years ago

We should add support that allows people to translate the editor to other languages, it shouldn't be too difficult to do so, just time consuming, since every string in the editor has to be found and replaced with a translation.

C# desktop apps comes baked in with localization support through .resx files, very convenient from the coder's perspective since it allows us to easily reference strings as constants generated from a .xml file. Not very convenient from a translators's perspective since the .xml file is verbose and full of comments, also you have to build the application to test changes.

Reading from .yaml at runtime would probably be the most convenient from the translator's perspective, .yaml is non-verbose and simple, and they could test their changes without relying on a compiler. Less convenient from the coder's perspective since we have to build more stuff from scratch probably, unless there exists a .NET framework for localization from .yaml.

https://www.adventuregamestudio.co.uk/forums/index.php?topic=53883.msg636542454#msg636542454

ericoporto commented 4 years ago

I know this report in the forums is related to the Game dialogs , but the proposed idea of having ID strings is interesting and maybe could achieve what you are saying: https://www.adventuregamestudio.co.uk/forums/index.php?topic=57768.0 . In Java this can be handled in a similar manner with a properties file.

There are some strings that are seen on the Editor but not are not from it, and in this case I am talking about the compiler errors and warnings. I don't think those should be translated, because it will make it harder to search and act on reports. If they are translated, it's best to have them paired with compiler Error Codes, and a knowledge base that has these error codes would be possible to generate - a side benefit.

About finding the strings to be replaced, I use Rider, and it has refactor and search tools that are very good at finding stuff, but caution has to be exercised because some strings are actually IDs and they are used when generating the XML and other code, and some strings belongs in parsing of AGS Script.

And lastly, there is also the manual which should be a separated topic - my feeling regarding the manual translation is one can just replace it by a translated manual but I feel maintaining official translations of the manual and having them synced require too much effort.

persn commented 4 years ago

A .yaml file would support ID strings out of the box. Something written like

room:
  editor:
    title: "Room editor"
    cancelButton: "Close room editor"

could be referenced with room.editor.title and room.editor.cancelButton

Compiler errors, exception messages should remain in English. If someone shows me a stack trace in chinese there's not much I can do with it.

I agree the manual should be a separate issue

ericoporto commented 7 months ago

Found Aseprite is using simple ini files: https://github.com/aseprite/strings They are apparently linked to a webservice.

ivan-mogilko commented 7 months ago

There are some strings that are seen on the Editor but not are not from it, and in this case I am talking about the compiler errors and warnings.

Speaking of this, as we will gradually move to using standalone tools, this will become a general issue with getting output from tools.

Theoretically, it might be possible to localize tools as well, if they would accept some file of predefined name as a source for formatted strings for messages.

But I guess that's less priority than the Editor's UI.

ericoporto commented 7 months ago

I wouldn't localize command line tools, but I wouldn't mind if we came-up with a two letter + 4/5 number digit convention for error codes, as we could put error codes in a manual/knowledge base and still be able to improve error messages.

There's this error that I always hit in the Editor when starting from the Empty Game.

https://github.com/adventuregamestudio/ags/blob/a5b296dfdae704045bec20045922d673e5f8ce01/Editor/AGS.Editor/AGSEditor.cs#L1048

I think sometimes of adding a sentence to it "Make sure its 'StartingRoom' property is valid.", but I wonder if this is still not clear for someone and by modifying the sentence I make it hard to google, but having some error code would a modified sentence still hit helpful information.