vscode-gitlens icon indicating copy to clipboard operation
vscode-gitlens copied to clipboard

HELP WANTED: Add internationalization (i18n) support to GitLens

Open eamodio opened this issue 6 years ago • 24 comments
trafficstars

Here is a sample extension using the vscode-nls library

eamodio avatar Dec 06 '18 06:12 eamodio

I have tried to implement i18n with vscode-nls.

Then encountered a lot of difficulties

I found that vscode-nls is not so friendly.

here we go:

1. vscode-nls is not a standalone package

We have to use Transifex as a third-party hosting service that hosts i18n files.

If we need to modify the translation file, we need to log in Transifex and add a collaborator to modify it.

This undoubtedly prevents developers from further contributing to translation.

In order to integrate Transifex

We have to use Gulp, which is not very compatible with the workflow

2. official i18n example documenation not clear

How to write i18n file?

3. vscode-nls API too complicated

What did this function do?

That's all!

This is my experience after trying to use vscode-nls, very bad

I I disapprove follow offcial i18n example to implement i18n.

Here is my solution for easy use: https://github.com/axetroy/vscode-gpm https://github.com/shanalikhan/code-settings-sync

axetroy avatar Feb 10 '19 15:02 axetroy

While I agree that the official i18n sample is seemingly over complicated and the documentation is not very clear, the vscode-nls library which is standalone as far as can see, seems straight forward. I don't see where vscode-nls has any dependency on Transifex -- where is that?

Also will the files that have the localized strings be in the same format in what you are proposing vs vscode-nls?

eamodio avatar Feb 10 '19 15:02 eamodio

The examples you've posted are full extensions -- what are the pieces (and dependencies if any) that would be brought into GitLens?

eamodio avatar Feb 10 '19 15:02 eamodio

vscode-nls does not matter with Transifex.

But the official i18n example uses it. If you use vscode-nls alone, you have to explore it yourself.

The examples I've posted is the solution. not a library.

localized strings format same with official solution

You can see here:

English by default:

https://github.com/axetroy/vscode-gpm/blob/a00147fc2bc0e85296f65dcdf7c09a2dfba60cf1/package.nls.json#L1-L10

Chinese Simplified

https://github.com/axetroy/vscode-gpm/blob/a00147fc2bc0e85296f65dcdf7c09a2dfba60cf1/package.nls.zh-cn.json#L1-L10

axetroy avatar Feb 10 '19 15:02 axetroy

OK, sounds good -- thanks for the information. FYI, will also need to make sure the solution works well with webpack -- which will likely mean avoiding the use of require to load json files on disk -- instead use readFileSync

eamodio avatar Feb 10 '19 15:02 eamodio

@eamodio

Yes, the project must have the translation files.

Add copyPlugin to webpack to copy the translation file to the dist directory.

Because there is too much place to translate.

I suggest that the first stage of the translation of the command / configuration just fine.

axetroy avatar Feb 10 '19 16:02 axetroy

@axetroy works for me! Thanks again! Looking forward to the PR

eamodio avatar Feb 18 '19 23:02 eamodio

@eamodio Yes. I am working on it.

This will take a lot of time due to a large number of configuration items.

PR is coming soon...

axetroy avatar Feb 19 '19 05:02 axetroy

Actually,there is a more convenient way to implement i18n. Microsoft already has a tool called vscode-nls-dev , this tool automates the extraction of strings to be externalized from TS and JS code. And you can also add localization using Transifex.

chouzz avatar Oct 29 '20 14:10 chouzz

@chouzz PR is very welcome 😄

eamodio avatar Oct 29 '20 19:10 eamodio

@chouzz are you working on this? If not, I'd take a look.

goldst avatar Feb 10 '21 06:02 goldst

If you do add localization, please do so through Crowdin

ImRodry avatar Apr 11 '21 15:04 ImRodry

Quick update: I almost finshed a basic i18n system that uses vscode-nls-dev / webpack, but unfortunately I was quite occupied with other things in the last weeks. I hope to finish it next week.

vscode-nls-dev does not necessarily require a localization platform like Transifex (or Crowdin). In the most basic version one could just edit the json files that contain translations, and that is how my PR will work. I suggest that selecting and implementing the usage of a platform should follow in a separate PR.

goldst avatar Apr 16 '21 13:04 goldst

Editing json files directly through a PR is definitely not an ideal option. If you want many users helping out you will need to set up a Crowdin project otherwise the idea will most likely die pretty fast

ImRodry avatar Apr 16 '21 14:04 ImRodry

@ImRodry Yes, I am not saying that this project shouldn't use Crowdin or something comparable. I wanted to say that it is the second step and therefore should only be done after the first step - implementing vscode-nls-dev - is finished.

goldst avatar Apr 16 '21 20:04 goldst

But I think it should all be put in the same PR since the only thing crowdin needs is a crowdin.yml file on the repo and the rest is handled by the managers of the project on Crowdin itself. The configuration file should also be pretty simple

ImRodry avatar Apr 16 '21 20:04 ImRodry

非常希望能得到本地化的支持,这个插件非常棒

pgy866 avatar Nov 12 '21 10:11 pgy866

Hey everyone!

Do we have an update on this topic? I'm just looking around, maybe I can help with this!

erickisos avatar Feb 11 '22 17:02 erickisos

Just FYI, I've made a pull request introducing i18n support. I expect it may take some time until it can be approved and merged.

airaketa avatar Apr 04 '22 19:04 airaketa

@eamodio 我为它等了太久了,有什么能帮忙的吗😂

enhongchen avatar Oct 17 '22 06:10 enhongchen

Now can use l10n to support other language https://github.com/microsoft/vscode-loc

zWingz avatar Dec 01 '22 06:12 zWingz

Excuse me, how is the progress, looking forward to supporting multiple languages as soon as possible

xujz520 avatar May 10 '24 10:05 xujz520

I'm also looking forward to support for Chinese!

Xavier9896 avatar May 26 '24 05:05 Xavier9896

我也期待着对中文的支持!

Axiano avatar Apr 30 '25 08:04 Axiano

I'm also looking forward to support for Chinese!

uuiid avatar Sep 18 '25 08:09 uuiid

Hey @eamodio!

I see that there is still interest to getting this done, is there anything we can do to agilize this process? I'm looking forward to help with some of the translations, but would love to understand if from your perspective this is something that can't be achieved in the upcoming months.

erickisos avatar Sep 18 '25 17:09 erickisos

If possible, I can also provide some assistance

uuiid avatar Sep 19 '25 01:09 uuiid

我也期待着对中文的支持!

AkazaAkaria avatar Nov 01 '25 17:11 AkazaAkaria