bstascavage / plexReport

Scripts to generate a weekly email of new additions to Plex
67 stars 17 forks source link

Adding internationalization #51

Closed granbebe closed 9 years ago

granbebe commented 9 years ago

Hi,

I have added internationalization to the project and the french translations. I have solved some issues in installation process.

Nicolas

bstascavage commented 9 years ago

This looks great! It has been on my list for a while to support this, but looks like you beat me too it! Let me test it and review it first, but at first glance it looks great.

Have you tested this with languages other than French?

granbebe commented 9 years ago

I have tested it with german. The content is translated (ie what the script fetch from themoviedb.org and thetvdb.com) but the "static" texts are in english because it miss the translations for german.

To add full support of other languages, we simply need to create new locales files (like locales/de.yml) with the exact same keys as in the english locale file.

Simply said, if the requested language is not available, the script will fall back to english for the parts unavailable in the requested language. (It may cause issues if you specify a non existing language like 'adfzrd' I have not tested this case)

bstascavage commented 9 years ago

So I am noticing that not all text is being translated. Any reason why?

See: brian_stascavage_mail_-_felannisport_update__week_of_13_03_2015

bstascavage commented 9 years ago

Also, any reference for how to setup those locales/*.yml files?

bstascavage commented 9 years ago

BTW, this should address #40

granbebe commented 9 years ago

The content is fetched from the websites themoviedb and the tvdb. Unfortunattely this sites don't have all sumary in all languages. So what I did is : If we don't find the localised content we fall back to english which is better than nothing.

And about setuping the locale files : If you simply need to add a translation, just add the key in alphabetical order and its translation. You are required to add the english translation in its locale file. You don't have to edit the other ones unless you know how to translate the string in the given language.

If you want to add a new locale, you can start by fetching it here : https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale Just remember that, currently we only works with the language and not the country : Meaning the french should be fr.yml and not fr-CA.yml. The restriction is that we do not handle properly some specific ways to say something in different countries using the same language. What I did was taking the en.yml, keeping onlye the "date" items and adding what was needed. But you can also copy the en.yml to es.yml (for example), removing all translations, fetching the es.yml from the github repository I linked above and add the spanish text for the dates, then ask some native spanish speaker to translate the rest.

I will ask my boss to help on the german translations (as he is a native german).

Thanks for the merge.

bstascavage commented 9 years ago

Thank you so much for your help! This was such a great PR to merge, and really has helped out users!