Page MenuHomePhabricator

Add more languages in the tool's drop-down list
Open, Needs TriagePublic

Description

As T270263 is merged now, The L10n bot created lots of translation in many languages in the tool, So more languages needs to be added in the tool's drop-down list.

For getting an idea on how to add more languages, Please take a look at this patch: https://gerrit.wikimedia.org/r/650806

Helpful resources:

Code repos:

If you need any help, please feel free to comment here, happy to help you!

Event Timeline

Change 657066 had a related patch set uploaded (by Gopavasanth; owner: Gopavasanth):
[labs/tools/VideoCutTool@master] Added More languages in the tool's drop-down list

https://gerrit.wikimedia.org/r/657066

Change 657066 merged by jenkins-bot:
[labs/tools/VideoCutTool@master] Added More languages in the tool's drop-down list

https://gerrit.wikimedia.org/r/657066

At the moment I hard-coded the languages i18n files for importing, but we need a more generic method for dynamically importing and adding more languages in the tool's drop-down list. As L10n-bot keeps on adding more and more languages when they are translated :)

Hi @Uditdesai2206 Thanks for claiming the task!! Could you please share the progress on this task? Thanks!

Hi @Gopavasanth . Currently, the approach I am working on is similar to the one mentioned by you above, that is, hard-coding more languages . I am trying to find an approach that doesn't involve hard-coding for each language, but so far haven't been successful in doing so. Did you have any specific method in mind that you would like me to work on ?

Hey @Uditdesai2206 !

I just got some time to look at our current methods, We manually imported all languages from i18n folder to App.js and passed those values. May you could try to make this easier by change the code to something like this?

Instead of

import da from './i18n/da';
import de from './i18n/de';
import en from './i18n/en';
import es from './i18n/es.json';
import fi from './i18n/fi';.
.
.

Replace with the new code

  const context = require.context('./i18n', true, /.json$/);
  const languages = {};
  context.keys().forEach((key: any) => {
  const fileName = key.replace('./', '');
  const resource = require(`./i18n/${fileName}`);
  const namespace = fileName.replace('.json', '');
  languages [namespace] = JSON.parse(JSON.stringify(resource));
});
console.log(languages)

Also in the dropdown may be we could map these languages object elements with values and get the things work?

@Uditdesai2206 Are you still working on this. I can help if you want.

Hi @Gopavasanth . Sorry for the delay, got caught up in exams. I will work on your suggestion and update you on the same .

Hi @Uditdesai2206 , No worries. Good luck with your exams!! @Khr2003 If you want to contribute take a look on T252320. Thanks! :-)

Hey @Gopavasanth Can I take this up now? Since it has been a while.

Change 671200 had a related patch set uploaded (by SarthakKundra; owner: SarthakKundra):
[labs/tools/VideoCutTool@master] Generic method to import i18n languages

https://gerrit.wikimedia.org/r/671200

Change 671200 abandoned by SarthakKundra:
[labs/tools/VideoCutTool@master] Generic method to import i18n languages

Reason:
Couldn't implement dynamic dropdown with this approach.

https://gerrit.wikimedia.org/r/671200

Change 674294 had a related patch set uploaded (by SarthakKundra; owner: SarthakKundra):
[labs/tools/VideoCutTool@master] Dynamic dropdown for languages

https://gerrit.wikimedia.org/r/674294

Change 674295 had a related patch set uploaded (by SarthakKundra; owner: SarthakKundra):
[labs/tools/VideoCutTool@master] Add dynamic dropdown

https://gerrit.wikimedia.org/r/674295

Change 674294 abandoned by SarthakKundra:

[labs/tools/VideoCutTool@master] Dynamic dropdown for languages

Reason:

https://gerrit.wikimedia.org/r/674294