jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
418 stars 65 forks source link

Support locale and multi language #108

Closed parkmino closed 5 years ago

parkmino commented 5 years ago

I would like to contribute Korean translation.

jcorporation commented 5 years ago

This feature is on the roadmap.

parkmino commented 5 years ago

It would be good to have the option to choose a language.

koflesinge commented 5 years ago

I would like to do the french translation

jcorporation commented 5 years ago

I am working in the locale branch on this feature. The general i18n functions are working and the frontend is translated to german. Now I am working on the backend to emit translatable messages to the frontend.

For each language there are now separate text files with a simple syntax in the directory src/i18n/. A perl script creates a javascipt / json file from this files (called by mkdebug.sh and mkrelease.sh).

The syntax of this translation files is described in the wiki: https://github.com/jcorporation/myMPD/wiki/Translating

parkmino commented 5 years ago

Thanks a lot for your effort! ;-)

Yeah, I have been checking the locale branch from time to time. Please let me know when it is ready to add Korean translation. A couple of days would be enough for me to translate and I am considering to open another issue to attach ko-KR.txt file. PR seems too much for me only to upload the translated file.

jcorporation commented 5 years ago

My german translation is now finished. You can use the de-DE.txt file to translate myMPD in your language. Attaching a ko-KR.txt file is good enough, I can add it to the repository.

parkmino commented 5 years ago

OK and I will statrt the translation.

parkmino commented 5 years ago

Hmm... I translated the Korean and tried to test, however the following error message shows up in master build.

[ 20%] Building C object CMakeFiles/mympd.dir/src/mpd_client.c.o
/home/parkmino/Downloads/mpd/mympd/myMPD-master/src/mpd_client.c: In function ‘mpd_client_search_adv’:
/home/parkmino/Downloads/mpd/mympd/myMPD-master/src/mpd_client.c:3141:12: error: invalid type argument of unary ‘*’ (have ‘int’)
     (void) *sortdesc;
            ^~~~~~~~~
/home/parkmino/Downloads/mpd/mympd/myMPD-master/src/mpd_client.c:3144:12: error: invalid type argument of unary ‘*’ (have ‘unsigned int’)
     (void) *offset;
            ^~~~~~~
CMakeFiles/mympd.dir/build.make:110: recipe for target 'CMakeFiles/mympd.dir/src/mpd_client.c.o' failed
make[2]: *** [CMakeFiles/mympd.dir/src/mpd_client.c.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/mympd.dir/all' failed
make[1]: *** [CMakeFiles/mympd.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
jcorporation commented 5 years ago

This error should now be fixed.

parkmino commented 5 years ago

I put the translated ko-KR.txt file into i18n folder, however it is not listed in locale. Is there anything to check on my side?

jcorporation commented 5 years ago

The translation files must be added manually to the select in index.html. Automatic inclusion of translation files in the compile step comes in the next days.

jcorporation commented 5 years ago

Should now work, put your file in the i18n folder before calling ./mkrelease.sh. Please note that you must the write the friendly language name in the first line of the translation file.

parkmino commented 5 years ago

I do not see Korean still. I separately run tojson.pl and put it in /usr/share/mympd/htdocs/js/i18n.min, then it woks.

jcorporation commented 5 years ago

mkrelease.sh now runs tojson.pl at build time.

parkmino commented 5 years ago

Finally it works! Some translations seem missing as attached.

2019-06-21-003024_1600x900_scrot 2019-06-21-003053_1600x900_scrot 2019-06-21-003159_1600x900_scrot

jcorporation commented 5 years ago

I added the missing hooks in source and the phrases to de-DE.txt. Commits: 76a2ab640317a21db35d83e2ce74488149186ba8, bd05722221e3bf284cbc24751a5264628f67c036

parkmino commented 5 years ago

days/hours/minutes/seconds translation seems not to change properly according to the locale.

parkmino commented 5 years ago

One more missing translation found.

2019-06-21-072921_1600x900_scrot

parkmino commented 5 years ago

days/hours/minutes/seconds translation seems not to change properly according to the locale.

I think that those should be appended to the relevant translation, not en-US.txt I added the days/hours/minutes/seconds translation to ko-KR.txt, and it shows fine.

jcorporation commented 5 years ago

Error on my side. Last commit added: Days, Hours, Minutes, Seconds and Background phrases to translation framework.

parkmino commented 5 years ago

Thanks for your effort. Please find the attached file for the Korean translation.

ko-KR.txt

I will close this issue at once, and open new one when any update is needed.

jcorporation commented 5 years ago

Your translation is now integrated in the repository. Thanks for your effort.