steemit / condenser

The greatest application front-end to the Steem Blockchain.
https://steemit.com
504 stars 429 forks source link

Add i18n support #233

Closed f3rnando closed 6 years ago

f3rnando commented 8 years ago

I'm creating this issue in order to begin discussions on i18n support for steemit.com given that Im working into a clean, updated fork of this repo to include this feature.

Core points, questions and insights:

  1. Adding i18n support is quite easy, the biggest efforts reside on translation and on keeping translation files updated.
  2. I will PR as soon as spanish translations are done, in order to make merging relevant and useful right away.
  3. The modules/plugins that I chose are: react-intl and babel-plugin-react-intl. Are these fine? if any other should be considered, please propose it ASAP.
  4. The current i18n branch can be found here: f3rnando/steemit.com/tree/i18n
  5. The current status compare of steemit.com:master > f3rnando:i18n here
  6. Language selection should be automatic based on user locale
  7. A chinese speaking user might access from a browser asking en-US, and he might want to override that language selection. I will not develop this UI feature, I believe it is subjective and the steemit team will take over this task.
  8. I may give access to this repo to whoever wishes to collaborate and/or audit it.

Please reply referring to the list number, if any.

Updates coming soon.

f3rnando commented 8 years ago

If this proposal is given green light, I will rename the branch to reflect this issue's number.

mynameisek commented 8 years ago

Nice initiative... Was trying to work on this for a while, and bring developers to it. Heimindanger started something with me on http://94.23.30.172:3002/ (FR), and i'm finally quite BUSY on another project :) Very glad you work on it

https://github.com/yahoo/react-intl looks Ok you can also have a look to https://www.npmjs.com/package/i18n-react

skzap commented 8 years ago

Hi @f3rnando, we want to make a French website for steem with @mynameiskeo I would be able to help you for porting the code.

1) Agreed, there will be a lot of edits but it should be pretty straightforward.

6) We could also store the language preference of a user in the json_metadata, but I agree by default use the locale.

7) Different language clones actually serve a bigger purpose than just translating. They also promote certain tags (#ru , #cn , etc). If we have a UI to change language directly inside steemit.com I'm afraid these communities might die.

8) Please do, also can I contact you on steemit.chat? I am @heimindanger there

mynameisek commented 8 years ago

About language preference, we worked on Steemscript, which is a JSON standard for this json_metadata from user account. It will be released very soon

will look like this { "version": "0.0.1", "dns": {"records":[["@","CNAME","steem.io"]]}}, "profile": { "name": "Ned Scott", "email": "ned@steem.io", "birthday": "12/12/1212", "gender": "male", "about": "CEO and Co-founder at Steemit", "first_name": "Ned", "last_name": "Scott", "location": "New York", "timezone": "-5", "locale": "en_US", "language": ["en"], "website": "", "cover_image": "", "profile_image": ", "featured_post": "" }

I also had the idea to show somehow the local currency equivalence, ($, €, CNY, JPY, etc)

handle TimeAgo, Date format, and promoted language tags

Please contact heimindanger and me @ekitcho @heimindanger so we can discuss about it

valzav commented 8 years ago

@mynameiskeo I think we can adopt format like this. Btw why do you need dns record? Also as far as I know there is one guy who is already working on i18n, let's see how he has advanced with his implementation, if he is ahead of anybody else we can take his solution as a base one.

mynameisek commented 8 years ago

@valzav about the format, we did spend time to discuss with several developers who planned or did use this json_metadata and try to find out the requirement.

If you know the guy working on i18n let us know so we can figure out how to contribute (cc @skzap @f3rnando ).

We definitely need a roadmap or something like a Trello to know who is working on what :) and how it can contribute to steemit

about DNS records, it comes frome @Someguy123 since dan announce about STEEM DNS https://steemit.com/namecoin/@dantheman/dns-via-steem he did use json metadata https://steemit.com/steemit/@someguy123/steem-dns-your-username-dot-steem-dns-on-the-blockchain

but that's not mandatory

Undeadlol1 commented 8 years ago

I am front-end developer of russian steemit project (we are called 'golos'). I have already done 90% of the work on i18n and more. Currently i am working on

In next few days i will be working on internationalisation of currencies through currency rates API's. Russian users should see their rewards in equivalent of russian rubles and lads from Great Britain should see money numbers in sterling pounds. (dunno if i will be able to implement this fully, but i will do my best)

You can check my progress at our 'develop' branch of our project. I documented everything in app/locales/README.md and in app/Translator.jsx. If you want to see application translated to russian, you should go to Translator.jsx and change this

// to ensure dynamic language change, "key" property with same "locale" info must be added
return  <IntlProvider locale={languageWithoutRegionCode} key={languageWithoutRegionCode} messages={messages}>

to this

return  <IntlProvider locale={'ru'} key={'ru'} messages={messages}>

@f3rnando and @skzap you should really check my repo, so you will not have to recreate the will.

Btw i am having a little bit of a trouble implementing international tags and topics, because https://steemit.com/trending/конский just doesn't want to work for me. If you have any input or know anyone who i can talk to, it would be great.

f3rnando commented 8 years ago

@Undeadlol1 I was aware of golos :) I will defintely check that implementation. Your <IntlProvider line clearly shows that you are in the same path as I am.

@mynameiskeo, @skzap lets start a steem.chat i18n-effort channel. To begin with. :)

I'm happy to hear from you all. Thanks.

f3rnando commented 8 years ago

I just created an organization to keep it clean. Added you guys as members with full access. https://github.com/steemit-intl

f3rnando commented 8 years ago

@valzav @jcalfee @roadscape @mynameiskeo @skzap we were discussing in steemit.chat (steemit-i18n-dev channel) a few points to get this done:

  1. Should we wrap strings before PR or would it be better to PR just the i18n support files? If we take the task to wrap all strings, it could get to be a merge nightmare for you (steemit devs)
  2. What naming should be choosen? I personally like __(), others prefer translate(), none or a few t().
  3. given #2 what about html and plurals translate? (eg: p() HTML, translateHTML(), etc) @Undeadlol1 is already using translate(), I believe that this might be the logic way to go.
  4. Should I rebase previous to PR? or merge? or pull --rebase? Please indicate the best approach.
  5. Update: Finally, babel-plugin-react-intl wasnt used.

Thanks in advance.

valzav commented 8 years ago
  1. Let's start with i18n support files, we can add translations later.
  2. I would prefer t() or translate()

@f3rnando as I understand your solution is separate from @Undeadlol1 so they have nothing in common?

f3rnando commented 8 years ago

@valzav It is derived from @Undeadlol1's code, with a few tiny changes here and there.. Notice that Golos changed a few things since then, so It might look a bit different now. Sadly I had to leave out a lot of code from Golos, as it is substantially diverging, my concern was to make a branch that is easy to merge.

It's not really a lot of code, you might refactor it all by yourself, I believe that you will find useful mostly the lang files.

valzav commented 8 years ago

Let's continue to work on i18n support in this https://github.com/steemit/steemit.com/tree/233-i18n branch.

valzav commented 8 years ago

I'm going to merge branch 233-i18n into develop today

roadscape commented 8 years ago

Cross-posting from https://github.com/steemit/steemit.com/pull/430:


IMO, translations need namespacing otherwise they will get out of control.. here's examples of what I consider developer/translator-friendly structure:

https://github.com/plataformatec/devise/blob/master/config/locales/en.yml https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml

It would be better to do this sooner than later

sneak commented 8 years ago

internationalization

TimCliff commented 8 years ago

Sorry for the 'stupid question', but can someone please explain what this new feature will do? I can tell it has something to do with language transition, but how will it actually impact what users can do on the site?

sneak commented 8 years ago

This allows the site to present the site UI in multiple languages, depending on the language setting of the browser accessing.

i18n = an i, followed by 18 letters, followed by n = internationalization

valzav commented 7 years ago

There are a lot of Invariant Violation: [React Intl] TheIntlAPIs must be available in the runtime, and do not appear to be built-in. AnIntlpolyfill should be loaded. errors. I need your help with loading Intl polyfill.

Undeadlol1 commented 7 years ago

https://github.com/GolosChain/tulupchik/blob/master/server/server-html.jsx#L28 https://github.com/GolosChain/tulupchik/blob/master/app/locales/README.md#how-to-add-your-own-language

relativityboy commented 6 years ago

@valzav @originated - should this issue be closed?