github-langs icon indicating copy to clipboard operation
github-langs copied to clipboard

Support dual-language

Open wildan3105 opened this issue 4 years ago • 19 comments

Current behavior: Only support English with no localization

Expected behavior: Support English and Indonesian

Steps to reproduce: Go to the homepage

wildan3105 avatar Jul 19 '20 05:07 wildan3105

Can we do multi-language though using our template engine (handlebars)?

wildan3105 avatar Oct 02 '20 04:10 wildan3105

Which files need to be translated into Indonesian? Maybe I can help?

dhapin avatar Oct 03 '20 08:10 dhapin

I'm planning to translate this into Indonesian because that's my native language :sweat_smile: I can provide the translation but I need your help to find a way to do the localization using handlebars. Maybe these links would help?

  • https://stackoverflow.com/questions/7760332/how-to-make-i18n-with-handlebars-js-mustache-templates
  • https://coderwall.com/p/77flzq/localized-templates-with-handlebars-mustache

Pretty much everything needs to be translated (Footer label, the random statements, buttons). But I think we can start by providing a simple button at the top-left of the page in which we can easily switch from English to Indonesian content.

What do you think @dhapin ?

wildan3105 avatar Oct 03 '20 08:10 wildan3105

Adding this to the milestone: https://github.com/wildan3105/github-langs/milestone/3 for better trackability

wildan3105 avatar Oct 03 '20 08:10 wildan3105

Do you think this is correct? #173 Sorry if there are some errors :(

dhapin avatar Oct 03 '20 09:10 dhapin

I think you misunderstand :sweat_smile: What I mean is to support, not just translate. If just translating, then it will change the whole content to Indonesian. Please update your implementation to support both Bahasa Indonesia & English

wildan3105 avatar Oct 03 '20 09:10 wildan3105

Do you think this is correct? #173 Sorry if there are some errors :(

Never mind the warning, it doesn't matter as long as it's passing the unit test.

wildan3105 avatar Oct 03 '20 09:10 wildan3105

I believe you can utilize this library: https://github.com/mashpie/i18n-node Let's make a simple change first, starting from the footer content so it will have both EN and ID content. You can find the footer content here: https://github.com/wildan3105/github-langs/blob/87665d6f0bf3de1235f2c25bda3733e58bc75d9d/views/partials/body.handlebars#L100

wildan3105 avatar Oct 03 '20 09:10 wildan3105

How?

dhapin avatar Oct 03 '20 09:10 dhapin

I dont really understand what you mean

dhapin avatar Oct 03 '20 09:10 dhapin

Your pr is only translating the content, not supporting dual-language. Are you aware of it firstly?

If you're aware, then you can update your implementation if you still work on this issue (take a look at this example: https://gist.github.com/mashpie/5246334). Else, I'd do it by myself.

wildan3105 avatar Oct 03 '20 09:10 wildan3105

If this is too complicated for you, contribution to other issues are also welcome :slightly_smiling_face:

wildan3105 avatar Oct 03 '20 09:10 wildan3105

I'm planning to translate this into Indonesian because that's my native language sweat_smile I can provide the translation but I need your help to find a way to do the localization using handlebars. Maybe these links would help?

* https://stackoverflow.com/questions/7760332/how-to-make-i18n-with-handlebars-js-mustache-templates

* https://coderwall.com/p/77flzq/localized-templates-with-handlebars-mustache

Pretty much everything needs to be translated (Footer label, the random statements, buttons). But I think we can start by providing a simple button at the top-left of the page in which we can easily switch from English to Indonesian content.

What do you think @dhapin ?

Sorry if I'm being not clear here. My apologies but I think you already got my point right? It's for supporting dual-language, not just translating it.

wildan3105 avatar Oct 03 '20 09:10 wildan3105

Can you explain it in Indonesian? :)

dhapin avatar Oct 03 '20 09:10 dhapin

Oke tidak apa-apa karena sesama orang Indonesia ya haha. Jadi kebutuhannya adalah untuk men-support dua bahasa, Indonesia dan Inggris. Bukan menerjemahkan, tapi menyediakan opsi agar pengguna bisa memilih antara bahasa Indonesia dan Inggris.

wildan3105 avatar Oct 03 '20 09:10 wildan3105

bikin tombol baru di kiri atas?

dhapin avatar Oct 03 '20 10:10 dhapin

Cara biar 1 html bisa berisi 2 bahasa gimana?

dhapin avatar Oct 03 '20 10:10 dhapin

Ok sepertinya saya sudah ada ide

dhapin avatar Oct 03 '20 10:10 dhapin

image Silahkan dicek @wildan3105 untuk PR #176 🙏 Perubahan ini akan mengikuti bahasa yang digunakan browser, jadi tidak ada element html yang ditambahkan.

dhapin avatar Oct 04 '20 09:10 dhapin

Sorry @dhapin, I had to close this as this is no longer valid for the future of this project. Thanks for taking the time to work on this!

wildan3105 avatar Aug 19 '23 04:08 wildan3105