gitkraken / vscode-gitlens

Supercharge Git inside VS Code and unlock untapped knowledge within each repository — Visualize code authorship at a glance via Git blame annotations and CodeLens, seamlessly navigate and explore Git repositories, gain valuable insights via rich visualizations and powerful comparison commands, and so much more
http://gitkraken.com/gitlens
Other
8.97k stars 1.32k forks source link

HELP WANTED: Add internationalization (i18n) support to GitLens #577

Open eamodio opened 5 years ago

eamodio commented 5 years ago

Here is a sample extension using the vscode-nls library

axetroy commented 5 years ago

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

eamodio commented 5 years ago

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 commented 5 years ago

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

axetroy commented 5 years ago

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

eamodio commented 5 years ago

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

axetroy commented 5 years ago

@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.

eamodio commented 5 years ago

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

axetroy commented 5 years ago

@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...

chouzz commented 3 years ago

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.

eamodio commented 3 years ago

@chouzz PR is very welcome 😄

goldst commented 3 years ago

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

ImRodry commented 3 years ago

If you do add localization, please do so through Crowdin

goldst commented 3 years ago

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.

ImRodry commented 3 years ago

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

goldst commented 3 years ago

@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.

ImRodry commented 3 years ago

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

pgy866 commented 2 years ago

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

erickisos commented 2 years ago

Hey everyone!

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

airaketa commented 2 years ago

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.

enhongchen commented 2 years ago

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

zWingz commented 1 year ago

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

xujz520 commented 5 months ago

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

Xavier9896 commented 4 months ago

I'm also looking forward to support for Chinese!