Blockrazor / blockrazor

Absolutely ALL information about EVERY blockchain project in a comparison tool that ANYONE can understand. Administered by @gazhayes
Mozilla Public License 2.0
48 stars 55 forks source link

Problem: It's difficult for non-tech people to add translations (#1994) #2019

Closed anbud closed 6 years ago

anbud commented 6 years ago

Solution: Automatically generate translation forms based on the translation scope and missing translation keys and allow users to easily enter new translation data. Save data directly to a json file so it's instatly ready for use.

gsovereignty commented 6 years ago

@anbud how/where are the translations saved?

anbud commented 6 years ago

Currently, it's very basic, it saves the translation files right back to i18n folder in the root of the project and merges it with existing translation files (to support partial translations). Now, that's the simplest approach. Of course, it takes care of the security aspect and data is sanitized before it's written to the file system. And if somebody tries to submit blank values for existing translations, they will be ignored.

I also had in mind that we could save translations in the database first and that they can be merged with existing translations when moderators decide whether it's good or not. But that could be a new issue.

gsovereignty commented 6 years ago

OK.

The problem with that is that in production everything is pulled from master and rebuild for node. So no changes made on production will survive.

I haven't looked at the i8n package, how hard would it be to fetch translations straight from mongo instead of the file system?

anbud commented 6 years ago

Oh, that is a problem.

Well, I've just did a little bit of research, there are two possible solutions here then:

  1. We could convert Tapi18n to use mongodb, we would have to fork it, but there's a backend plugin for i18next (which tapi18n just proxies) which uses mongodb, so it shouldn't be that hard if the plugin is working correctly.
  2. We could leave the existing solution, save new translation data to the database and when moderators approve, we can send a new PR (emurgobot's credentials could be used here) with new translation files.

What do you think? Both solutions aren't that hard to implement and they're almost equal complication-wise.

gsovereignty commented 6 years ago

Hmmm, since they are basically both the same amount of effort, it's probably better to go with 2 so that when we start getting serious traffic it removes a tiny amount of mongodb bottleneck if there are multiple nodejs instances. It's also probably more of a C4ish way to do it.

anbud commented 6 years ago

You're right, it is a little bit more c4ish. Ok, that's how I'll do it, I'll send a PR later today. :)