Page MenuHomePhabricator

Dynamically import languages list for VideoCutTool dropdown
Closed, ResolvedPublic

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:

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

Hi @SarthakKundra, Left some comments on your patch. Please feel free to update accordingly :)

Hi @Gopavasanth , I have made a PR please review it and suggest the required changes if needed.

Change 773393 had a related patch set uploaded (by Aklapper; author: Abhigya Pandey):

[labs/tools/VideoCutTool@master] Add more languages in the tool's drop-down list

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

@abhigya_pandey: Please see Gerrit for required corrections (no need to manually announce patchsets here in Phab). Thanks a lot! :)

Change 674295 abandoned by Gopavasanth:

[labs/tools/VideoCutTool@master] Add language map

Reason:

Supressed due to: https://gerrit.wikimedia.org/r/c/labs/tools/VideoCutTool/+/773393/

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

Gopavasanth removed a project: Patch-For-Review.
Gopavasanth updated the task description. (Show Details)

Change 773393 abandoned by Gopavasanth:

[labs/tools/VideoCutTool@master] Add more languages in the tool's drop-down list

Reason:

Thanks for your patch, Source code is updated!

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

Change 872957 had a related patch set uploaded (by Punith.nyk; author: Punith.nyk):

[labs/tools/VideoCutTool@master] T272240 Add more languages in the tool's drop-down list. Added more extra languages in the dropdown menu.

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

Hmm, where do these translations come from / who created them and how?

@Punith.nyk: Could you answer my last question? Thanks you!

do we have to add more languages in? is this open?

Frostly renamed this task from Add more languages in the tool's drop-down list to Dynamically import languages list for VideoCutTool dropdown.Jan 31 2023, 2:44 AM

Thanks for the resources, I'll be starting this now

Hey @Aklapper @Gopavasanth, should i add json files manually? or is there a way to automatically add them on this repo (by i18) ?

Change 872957 had a related patch set uploaded (by Punith.nyk; author: Punith.nyk):

[labs/tools/VideoCutTool@master] Add more languages in the tool's drop-down list.

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

hey @Punith.nyk, if you want to send a patch / have a existing patch do claim the issue, to avoid confusion, and waste of time.
Not to keep count or anything, but this is happening to me like 2/3 times :(

Hi @Punith.nyk , Appreciated your enthusiasm and interest!!

Before beginning any task related to VideoCutTool, it is recommended that you first check if the task has already been claimed. This can be done by verifying the status of the task on Phabricator, If the task has already been claimed, it would be best to provide feedback on the ticket, or if you have a solution in mind, you can also suggest it on the ticket. This can prevent duplicate efforts and save time.

Furthermore, all the JSON files in the i18n directory of VideoCutTool are generated by a bot, which retrieves translation strings from TranslateWiki. You can visit the following page to learn more about translating VideoCutTool on TranslateWiki: https://translatewiki.net/wiki/Translating:VideoCutTool. Additionally, if you're interested in learning more about the bot used to generate the JSON files, you can refer to this Gerrit patch for more information: https://gerrit.wikimedia.org/r/c/labs/tools/VideoCutTool/+/889792.

Hey,@Reputation22 how did you claim this task when there was already a patch created before . I think you are not supposed to do so :) . I apologize for the inconvenience

Hey,@Reputation22 how did you claim this task when there was already a patch created before . I think you are not supposed to do so :) . I apologize for the inconvenience

uhmm when i claimed the task, there was no patch-for-review, and no assignees :)

Change 904758 had a related patch set uploaded (by Reputation22; author: Reputation22):

[labs/tools/VideoCutTool@master] Adds dynamic language list to dropdown

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

Here is a parallel patch for updating the language list dynamically. I checked the concerned patches and none of them were in the state of getting accepted.

Change 872957 abandoned by Punith.nyk:

[labs/tools/VideoCutTool@master] Add more languages in the tool's drop-down list.

Reason:

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

Reputation22 moved this task from Doing to Done on the VideoCutTool board.