austencm / youtube-auto-like

Chrome extension that automatically likes videos from your subscribed channels.
MIT License
163 stars 53 forks source link

Internationalization ? #5

Closed Taknok closed 7 years ago

Taknok commented 7 years ago

I added 3 js line to allow internationalization by adding span element in the dom. With an id i18n-qwerty it will insert the message specified under qwerty from _locales/[navigator_leng]/messages.json I also provided FR and SP.

austencm commented 7 years ago

Nice, thank you! I've actually been working on an i18n module that replaces text content directly using Chrome's __MSG_strName__ syntax. I'm going to push that update, then would you mind resubmitting this with just the language files?

Taknok commented 7 years ago

Hum I didn't found anything about MSG_strName on the web ? What is it ? :) I actually can remove the "coded" files from this PR and keep only the language files.

austencm commented 7 years ago

Take a peek at the i18n documentation. In manifest.json and CSS files, Chrome will automatically replace instances of __MSG_messagename__ with the matching message. I just wrote a string replacer that does the same for the HTML files.

If you want to just leave the language files, that would work, but I updated the EN file so they need to be matched with that.

Taknok commented 7 years ago

Ok I see, I didn't wanted to bother me with string search in HTML so I put span with ID, but else it's quite the same process. I'm updating the language files

Taknok commented 7 years ago

Everything is updated ! Now I have to merge my repo with those new changes (same fonctionnalilties in parallel but slightly different).

austencm commented 7 years ago

You're awesome! I'll publish this version soon.