joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.78k stars 382 forks source link

Translating DOSBox-X: ideas, issues, solutions #2693

Open aybe opened 3 years ago

aybe commented 3 years ago

A quick test is available here: https://github.com/joncampbell123/dosbox-x/tree/translation

Not sure what's going on with the escape codes though:

dosbox-x_2021-07-21_06-27-13

Most importantly, the way it is used is weird, .PO files are supposed to be like this:

msgid "source text"
msgid "translated text"
...

But they are like this:

msgid "AUTOEXEC_CONFIGFILE_HELP"
msgstr ""
"Lines in this section will be run at startup.\n"
"You can put your MOUNT lines here.\n"
"\n"

So in the end, they don't follow the rule, forcing one to peek onto the original en-US to find out the original text, pretty boring.

Even more boring: re-write tons of code to conform to that fact; not sure if it's a really good idea.

Now, if say you'd use something like VS Code with synchronized scroll bars, with on the left, the original, on the right the translation, you effectively completely remove the need of gettext and poedit and can stay on the original system which already works.

The only thing that might be of interest in this branch then is what I did here, replace those ◙ U+25D9 by new lines so one doesn't need to use incredibly boring horizontal scrollbars in addition to vertical ones.

TL;DR; the good ol' system is quite effective, upgrading might not be that worth in the end

EDIT: see next post, I think it's a better solution

aybe commented 3 years ago

Take 2 😀

As I was translating manually to FR, I started using DeepL which really has amazing translation.

I then realized this could be automated and then review process would be a walk in the park.

There you go, a program that translates .LNG files:

https://github.com/joncampbell123/dosbox-x/tree/translation/contrib/translations/dosbox-translation-deepl

VsDebugConsole_2021-07-21_08-24-56 cmd_2021-07-21_08-32-09

You just need to register for a free API key and you're good: https://www.deepl.com/docs-api/accessing-the-api/

An example of translation:

https://github.com/joncampbell123/dosbox-x/blob/translation/contrib/translations/deepl%20translations/fr_FR.lng

:AUTOEXEC_CONFIGFILE_HELP
Les lignes de cette section seront exécutées au démarrage.
Vous pouvez placer vos lignes MOUNT ici.
.

:CONFIGFILE_INTRO
# Ceci est le fichier de configuration pour DOSBox-X %s. (Veuillez utiliser la dernière version de DOSBox-X)
# Les lignes commençant par un # sont des lignes de commentaires et sont ignorées par DOSBox-X.
# Ils sont utilisés pour documenter (brièvement) l'effet de chaque option.
# Pour écrire TOUTES les options, utilisez la commande 'config -all' avec les options -wc ou -writeconf.
.

It's amazingly good, just needs some manual review 😎

As for the fixing, I'd go VSCode like this:

Code_2021-07-21_08-34-39

Done using right-click on Explorer side bar:

But as you can see FR is problematic, if you want to be clear you have to be verbose and end up being much longer than US:

dosbox-x_2021-07-21_08-38-59

OTOH you can go terse but then it sounds dull... translation is a job in itself, not easy.

All in all, I think pre-translating the bulk will undoubtedly help because it relieves the user from painful typing and he can focus on improvements.

Wengier commented 3 years ago

@aybe Thanks a lot for comparing between the two approaches and the finding! Based on your find I think keeping using language files is likely a better idea for the purpose of DOSBox-X. But I think the line ending issue (◙ U+25D9) does need to be fixed as you said. So I fixed it both in the code and in language files. As a result, trying to generate language files will properly output the newline character instead of the boring character ◙ as you said. Thanks!

aybe commented 3 years ago

Nice, when I get some free time, I'll manually edit the FR translation, it's on my desktop. 😉

Wengier commented 3 years ago

@aybe After the fix I have been looking at your French translation you posted, and very glad to see you had almost done it already. Wonderful work, and great tool you had introduced. This tool can definitely help others too. In the language file itself, it looks like some lines in the welcome message has overflown the screen, so they need to be shortened. For example, for the following line:

Tapez HELP pour voir la liste des commandes du shell, INTRO pour une brève introduction.

It is apparently too long for a screen line. Is it possible to shorten such lines, as long as they are clearly understandable by readers?

Once again, thanks a lot for the translation! Will add to the installer as soon as it is done. Great work!

aybe commented 3 years ago

As for getting translation done soon, it's a no, loud and clear.

I've been trying to translate for the last 2 hours and it's extremely long and error-prone, I've only been able to fix intro screen and some configuration tool stuff.

I've only done that and barely scratched the surface:

https://github.com/joncampbell123/dosbox-x/commit/8782143b30cfae2fa2bf3f5eba97fce808049a7a

Also, the order in the .LNG file does not help but not sure if it's fixable anyhow.

You progress really slowly because you have to test every time until it's right. And I ran the program 100s of times to simply check the results!

Furthemore, those ANSI codes are sometimes poorly written and can be edited to gain these precious spaces to be able to fit long sentences; that adds up to the process.

Also, some of these should be addressed to make the process easier:

2698

2699

2700

2701

2702

2703

This pattern seems to be a good approach, you can quickly make changes and compare, maybe this could be put on some translation guide:

2021-07-21_22-06-04

As you can see, lots of compromises to make it sound natural, in the mean time some errors have slipped in (ANSI colors).

aybe commented 3 years ago

@Wengier

https://github.com/joncampbell123/dosbox-x/commit/ffb1606d39a7e84ea6646d4789c31c143495ddb6

That'll have to wait, I thought I could tackle it today but I barely made any progress...

It's just a massive job, way bigger than one might think:

When it comes to software, FR totally sucks... personally I have all keyboard and operating system in EN-US !

In short, it's very long, spent already 4 hours on it and I'm far from completion, but I've committed it anyway so it's not lost.

For the next victim who may want to continue the work:

aybe commented 3 years ago

@Wengier

Wanted to add, when you look at the commit, you may read it in like 30 seconds but believe me, it's a +2 hours job.

Think of it like it's code, imagine handling a file of 3719 lines of C code, which is how long the .LNG is, some may argue LOC isn't a metric but it tells quite a bit; it isn't trivial at all!

Two things that may help:

Doing so would certainly ease the translation because I suppose there is some kind of logic in the identifiers of items to be translated so, having them in order is certainly interesting to try.

aybe commented 3 years ago

@Wengier

I've added:

https://github.com/joncampbell123/dosbox-x/tree/develop/contrib/translations

aybe commented 3 years ago

@Wengier @joncampbell123

Check this:

https://github.com/joncampbell123/dosbox-x/blob/develop/contrib/translations/docs/README.translation.MD

https://github.com/joncampbell123/dosbox-x/tree/develop/contrib/translations/docs

Anyone reading it should be able to do translations, the process seems right to me but should be tested and possibly improved.

Also, there are two things still left to do in the TODO section, see how these should be addressed.

aybe commented 3 years ago

Here are builds of the program, apparently the new Portable format makes them able to run on any platform:

dosbox-translation-tools.zip

For Windows it works but for the others I don't know because I don't have them.

They will need .NET 5 runtime:

https://docs.microsoft.com/en-us/dotnet/core/install/windows?tabs=net50 https://docs.microsoft.com/en-us/dotnet/core/install/linux https://docs.microsoft.com/en-us/dotnet/core/install/macos

I tried to build self-contained ones but they each do 60Mb, that would have made a whopping 360Mb zip, so abandoned the idea.

aybe commented 3 years ago

@Wengier

https://github.com/joncampbell123/dosbox-x/blob/develop/contrib/translations/fr/fr_FR.lng https://github.com/joncampbell123/dosbox-x/blob/develop/contrib/translations/fr/fr_FR%20translation%20notes.txt

Two thirds done, the last third is an order of magnitude longer, don't expect it in a reasonable time frame!

Then there will be the fixing phase, normalization phase and finally improvement phase...

Honestly? FR totally sucks for software... When literature tries to describes technic but fails in doing so by being so verbose.

Even though manual editing clearly improves the situation, it's by a small margin, look at this overflow fest:

dosbox-x_2021-07-24_07-23-09

This is the kind of stuff remaining to do, one will clearly have to make compromises to ensure it fits:

dosbox-x_2021-07-24_07-29-44

dosbox-x_2021-07-24_07-34-46

I now understand why so many abbreviations are used for this language in software!

🤣

FredBezies commented 3 years ago

Indeed, there are overflow everywhere. In many software, buttons size are resized automatically which removes a lot of problems.

I looked at the current file and I fixed the biggest mistake, in order to save some times while doing the polishing work.

See this pull request: https://github.com/joncampbell123/dosbox-x/pull/2712

I fixed the biggest mistakes I found. There will be a lot of work to fix everything...

I hope it helps cleaning this draft and make translating easier.

I cannot use your tool because I left MS-Windows back in 2006.

Have a good day.

Wengier commented 3 years ago

@aybe Thanks a lot for the translation guide and translation fixes. They are greatly helpful indeed.

For the overflow issue, I think the biggest restriction is still on the screen width - the standard 80-lines can not be overcome. So I guess one has to make compromises in such cases.

FredBezies commented 3 years ago

I find the fix for help utterly broken output.

In the current translation, you have an empty line a dot and another empty line. Which is wrong.

:SHELL_CMD_CHDIR_HELP
Affiche ou modifie le répertoire actuel.

.

:SHELL_CMD_CHDIR_HELP_LONG

But in the english file, there is an empty line, a dot and then a new entry. Not an useless empty line which breaks everything.

:SHELL_CMD_CHDIR_HELP
Displays or changes the current directory.

.
:SHELL_CMD_CHDIR_HELP_LONG

When I follow the empty line and the dot like in the english file, it works better. As a proof of concept, I modified every single command invoked with help.

I think attached screenshot speaks for itself :)

Capture d’écran de 2021-07-24 14-04-30

FredBezies commented 3 years ago

I used @aybe translation file to start - and thanks for the big work already done here - and modified it.

This afternoon I took 2 hours to fix all the badly placed empty lines, and fixed some translations here and there. I made a small video to show the progress.

Translation file used added as an attachment. fr_FR.lng.txt

I hope it will help a little.

Besides some lines that need to be modified in length, it is a previous good preview of what Dosbox-X can look like in french. I used Dosbox video recorder to show everything.

If you want my translation file, just tell me. It will save a lot of hours of work.

You can see this video clicking on this mega link: https://mega.nz/file/X7YHWIzT#WX2z8XowfaAJ5qrHTn9DGUdGExEjMlBZ6-C26m8_Cxs

And some screenshots:

dbx-french mp4-00:00:06 535

dbx-french mp4-00:00:13 398

dbx-french mp4-00:01:04 420

Wengier commented 3 years ago

@FredBezies Thanks for the updated language file. It is certainly an improvement over the previous one. Meanwhile, you may want to look at the mapper editor and help messages for DOS shell commands, e.g. DIR /?. They are apparently a few overflows that may be adjusted to make them look better.

Wengier commented 3 years ago

@FredBezies I have already updated the language file to use the updated one. Is it possible to cleanup the messages a bit more by the next version for inclusion in the installer?

Wengier commented 3 years ago

@aybe I have added a link to the translation guide you made to the README page. Hope it will help others too.

FredBezies commented 3 years ago

@FredBezies Thanks for the updated language file. It is certainly an improvement over the previous one. Meanwhile, you may want to look at the mapper editor and help messages for DOS shell commands, e.g. DIR /?. They are apparently a few overflows that may be adjusted to make them look better.

I will look at help messages. For mapper part, I cannot do anything before next tuesday.

Will post an updated version for help part asap :)

FredBezies commented 3 years ago

@FredBezies I have already updated the language file to use the updated one. Is it possible to cleanup the messages a bit more by the next version for inclusion in the installer?

Another patch with a more cleaner help output and fixes for PC-98 intro is available. Feel free to merge it. See https://github.com/joncampbell123/dosbox-x/pull/2718

This new patch is making french translation looks good :)

Wengier commented 3 years ago

@aybe The translation guide appears to be no longer available from the page, so the link to it in README is now broken:

https://github.com/joncampbell123/dosbox-x/blob/develop/contrib/translations/docs/README.translation.MD

Can you post the guide page again so that it will be again accessible? Thanks.

(Once it is accessible again I will make it permanent)

aybe commented 3 years ago

Today's a great day:

Wengier commented 3 years ago

@aybe Wow. I think the original page was in the develop branch, which was probably later force-synchronized with the master branch and got lost. I wonder if there is a way to recover pages like this in general? The following page about Git may be useful:

https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery