Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Internationalize VS menus/commands #1933

Merged
merged 16 commits into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
preserve_hierarchy: true

files:
- source: /src/GitHub.Resources/Resources.resx
translation: /%original_path%/Resources.%locale%.resx
- source: /src/GitHub.VisualStudio/xlf/GitHub.VisualStudio.vsct.zh-CN.xlf
translation: /%original_path%/GitHub.VisualStudio.vsct.%locale%.xlf
- source: /src/GitHub.VisualStudio/xlf/VSPackage.zh-CN.xlf
translation: /%original_path%/VSPackage.%locale%.xlf
1 change: 1 addition & 0 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<configuration>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="Custom Packages for GHfVS" value="lib" />
</packageSources>
<activePackageSource>
Expand Down
34 changes: 34 additions & 0 deletions src/GitHub.VisualStudio/GitHub.VisualStudio.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<Import Project="..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.props" Condition="Exists('..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.props')" />
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.props')" />
<Import Project="..\..\packages\LibGit2Sharp.NativeBinaries.1.0.164\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.164\build\LibGit2Sharp.NativeBinaries.props')" />
<PropertyGroup>
Expand All @@ -11,6 +12,7 @@
<VsixType>v3</VsixType>
<IsProductComponent>false</IsProductComponent>
<ExtensionInstallationFolder>GitHub\GitHub</ExtensionInstallationFolder>
<XlfLanguages>zh-CN</XlfLanguages>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice you've specified zh-CN here rather than zh-Hans (which I think is simplified Chinese). Is the documentation on the https://github.com/dotnet/xliff-tasks README wrong?

XlfLanguages - The set of locales to which the project is localized. Defaults to the thirteen locales supported by Visual Studio: cs;de;es;fr;it;ja;ko;pl;pt-BR;ru;tr;zh-Hans;zh-Hant.

Does Visual Studio support zh-CN, zh-Hans and zh-Hant? 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm... not sure. The original PR had zh-HANS translations, but then when it was re-done in #1888, the translations that came from crowdin were zh-CN and this seems to work fine.

As for which is correct, I'm afraid I don't know enough about internationalization or Chinese in particular to say. I've tried googling and I'm not the wiser ;)

As I say, it seems to work fine, so ¯_(ツ)_/¯

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://twitter.com/jcansdale/status/1042490984892903424
Is it okay to use zh-CN instead of zh-Hans/zh-Hant in Visual Studio?

The resource manager will probe based on CurrentUICulture from a culture through its parents:

For zh-CN, this goes zh-CN -> zh-CHS -> zh-Hans.

This means, for example that if CurrentUICulture is zh-CN, then it will use zh-Hans resources, but not vice versa. It might be the case that VS always sets CurrentUICulture to zh-CN when using Chinese (Simplified) language pack, in which case it would work to use zh-CN, but I am not certain of that. If that isn't true, then using zh-CN will not work in all cases.

In the end, there are just two possible choices for VS language packs:

image

And their descriptions align to zh-Hans and zh-Hant

> using System.Globalization;
> new CultureInfo("zh-Hans").DisplayName
"Chinese (Simplified)"

> new CultureInfo("zh-Hant").DisplayName
"Chinese (Traditional)"

So I would suggest lining up with that and just using zh-Hans and zh-Hant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maikebing when you submitted the latest round of translations from crowdin using zh-CN rather than zh-Hans, was there a reason for that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid it doesn't appear to work when the Chinese (Traditional) language pack is installed. 😭

image

Copy link
Collaborator

@jcansdale jcansdale Sep 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that CultureInfo.CurrentUICulture is set to zh-TW when using the Chinese (Traditional) language pack. The parents of this appear to be zh-TW -> zh-CHT -> zh-Hant -> zh.

@nguerrera am I correct in thinking that zh-Hans and zh-Hant are treated like completely separate languages? There is no mechanism for zh-Hant to fall back to using zh-Hans?

<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
Expand Down Expand Up @@ -861,8 +863,40 @@
<Error Condition="!Exists('..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.targets'))" />
<Error Condition="!Exists('..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.props'))" />
<Error Condition="!Exists('..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.targets'))" />
</Target>
<Import Project="..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets" Condition="Exists('..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets')" />
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.targets" Condition="'$(VisualStudioVersion)' == '15.0' And Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.targets')" />
<Import Project="..\..\packages\Microsoft.VisualStudio.Sdk.BuildTasks.14.0.14.0.215\build\Microsoft.VisualStudio.Sdk.BuildTasks.14.0.targets" Condition="'$(VisualStudioVersion)' == '14.0' And Exists('..\..\packages\Microsoft.VisualStudio.Sdk.BuildTasks.14.0.14.0.215\build\Microsoft.VisualStudio.Sdk.BuildTasks.14.0.targets')" />
<!--
This is a workaround for allowing neutral CTO resource produced from *.vsct to go in the main assembly.
We move the neutral *.cto file to be categorized as WithCulture=true,Culture=en to prevent the tools from falsely reporting:
error VSSDK1006: Two CTO files have the same Menus.ctmenu resource name.
Note that this categorization does not apply to the items that actually produce the .resources.dll and so it will
not cause an English satellite to be generated.
The documented way around this is to put all resources (including neutral/en) in satellites:
https://msdn.microsoft.com/en-us/library/ee943168.aspx
However, that has consequences we do not want:
- It breaks resx code-gen to *.designer.cs
- It causes extra dll loads in en case
- If we ever split satellites in to language packs, the english fallback satellites would become a special case.
-->
<Target Name="AssignEnCultureToNeutralCto" BeforeTargets="MergeCtoResource">
<ItemGroup>
<_GeneratedCTOFilesWithCulture Include="@(_GeneratedCTOFilesWithNoCulture)">
<Culture>en</Culture>
<WithCulture>true</WithCulture>
</_GeneratedCTOFilesWithCulture>
<_GeneratedCTOFilesWithNoCulture Remove="@(_GeneratedCTOFilesWithNoCulture)" />
<_ResourcesToMergeWithCTOWithCultureMetadata Condition="'%(WithCulture)' != 'true'">
<Culture>en</Culture>
<WithCulture>true</WithCulture>
</_ResourcesToMergeWithCTOWithCultureMetadata>
</ItemGroup>
</Target>
<Import Project="..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.targets" Condition="Exists('..\..\packages\XliffTasks.0.2.0-beta-63125-01\build\XliffTasks.targets')" />
<Import Project="..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets" Condition="Exists('..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets')" />
<Import Project="..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.122\build\Microsoft.VisualStudio.Threading.Analyzers.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.122\build\Microsoft.VisualStudio.Threading.Analyzers.targets')" />
<Import Project="..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets')" />
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.targets" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3252\build\Microsoft.VSSDK.BuildTools.targets')" />
Expand Down
1 change: 1 addition & 0 deletions src/GitHub.VisualStudio/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@
<package id="SQLitePCL.raw_basic" version="0.7.3.0-vs2012" targetFramework="net45" />
<package id="Stateless" version="2.5.56.0" targetFramework="net45" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
<package id="XliffTasks" version="0.2.0-beta-63125-01" targetFramework="net461" />
</packages>
207 changes: 207 additions & 0 deletions src/GitHub.VisualStudio/xlf/GitHub.VisualStudio.vsct.zh-CN.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-CN" original="../GitHub.VisualStudio.vsct">
<body>
<trans-unit id="addConnectionCommand|ButtonText">
<source>&amp;Connect to GitHub</source>
<target xml:lang="zh-CN" state="translated">连接至GitHub(&amp;C)</target>
<note/>
</trans-unit>
<trans-unit id="addConnectionCommand|LocCanonicalName">
<source>.GitHub.ConnectToGitHub</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.ConnectToGitHub</target>
<note/>
</trans-unit>
<trans-unit id="backCommand|ButtonText">
<source>Back</source>
<target xml:lang="zh-CN" state="translated">返回</target>
<note/>
</trans-unit>
<trans-unit id="backCommand|LocCanonicalName">
<source>.GitHub.Back</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.Back</target>
<note/>
</trans-unit>
<trans-unit id="copyLinkCommand|ButtonText">
<source>Copy link to clipboard</source>
<target xml:lang="zh-CN" state="translated">复制连结到剪贴簿</target>
<note/>
</trans-unit>
<trans-unit id="copyLinkCommand|LocCanonicalName">
<source>.GitHub.CopyLink</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.CopyLink</target>
<note/>
</trans-unit>
<trans-unit id="forwardCommand|ButtonText">
<source>Forward</source>
<target xml:lang="zh-CN" state="translated">转发</target>
<note/>
</trans-unit>
<trans-unit id="forwardCommand|LocCanonicalName">
<source>.GitHub.Forward</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.Forward</target>
<note/>
</trans-unit>
<trans-unit id="githubCommand|ButtonText">
<source>View on GitHub</source>
<target xml:lang="zh-CN" state="needs-translation">View on GitHub</target>
<note/>
</trans-unit>
<trans-unit id="githubCommand|LocCanonicalName">
<source>.GitHub.ViewOnGitHub</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.ViewOnGitHub</target>
<note/>
</trans-unit>
<trans-unit id="goToSolutionOrPullRequestFileCommand|ButtonText">
<source>Go To Solution/PR File</source>
<target xml:lang="zh-CN" state="needs-translation">Go To Solution/PR File</target>
<note/>
</trans-unit>
<trans-unit id="goToSolutionOrPullRequestFileCommand|LocCanonicalName">
<source>.GitHub.GoToSolutionOrPRFile</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.GoToSolutionOrPRFile</target>
<note/>
</trans-unit>
<trans-unit id="helpCommand|ButtonText">
<source>Help</source>
<target xml:lang="zh-CN" state="translated">帮助</target>
<note/>
</trans-unit>
<trans-unit id="helpCommand|LocCanonicalName">
<source>.GitHub.Help</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.Help</target>
<note/>
</trans-unit>
<trans-unit id="idBlameCommand|ButtonText">
<source>Blame</source>
<target xml:lang="zh-CN" state="needs-translation">Blame</target>
<note/>
</trans-unit>
<trans-unit id="idBlameCommand|LocCanonicalName">
<source>.GitHub.Blame</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.Blame</target>
<note/>
</trans-unit>
<trans-unit id="idCreateGistCommand|ButtonText">
<source>Create a GitHub Gist</source>
<target xml:lang="zh-CN" state="translated">创建一个GitHub Gist</target>
<note/>
</trans-unit>
<trans-unit id="idCreateGistCommand|LocCanonicalName">
<source>.GitHub.CreateGist</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.CreateGist</target>
<note/>
</trans-unit>
<trans-unit id="idCreateGistEnterpriseCommand|ButtonText">
<source>Create an Enterprise Gist</source>
<target xml:lang="zh-CN" state="needs-translation">Create an Enterprise Gist</target>
<note/>
</trans-unit>
<trans-unit id="idCreateGistEnterpriseCommand|LocCanonicalName">
<source>.GitHub.CreateGistEnterprise</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.CreateGistEnterprise</target>
<note/>
</trans-unit>
<trans-unit id="idGitHubContextMenu|ButtonText">
<source>GitHub</source>
<target xml:lang="zh-CN" state="translated">GitHub</target>
<note/>
</trans-unit>
<trans-unit id="idGitHubContextMenu|CommandName">
<source>GitHub</source>
<target xml:lang="zh-CN" state="translated">GitHub</target>
<note/>
</trans-unit>
<trans-unit id="idGitHubToolbar|ButtonText">
<source>WindowToolBar</source>
<target xml:lang="zh-CN" state="needs-translation">WindowToolBar</target>
<note/>
</trans-unit>
<trans-unit id="idGitHubToolbar|CommandName">
<source>Window Toolbar</source>
<target xml:lang="zh-CN" state="needs-translation">Window Toolbar</target>
<note/>
</trans-unit>
<trans-unit id="openFromClipboardCommand|ButtonText">
<source>Open from clipboard</source>
<target xml:lang="zh-CN" state="needs-translation">Open from clipboard</target>
<note/>
</trans-unit>
<trans-unit id="openFromClipboardCommand|LocCanonicalName">
<source>.GitHub.OpenFromClipboard</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.OpenFromClipboard</target>
<note/>
</trans-unit>
<trans-unit id="openFromUrlCommand|ButtonText">
<source>Open from GitHub...</source>
<target xml:lang="zh-CN" state="needs-translation">Open from GitHub...</target>
<note/>
</trans-unit>
<trans-unit id="openFromUrlCommand|LocCanonicalName">
<source>.GitHub.OpenFromUrl</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.OpenFromUrl</target>
<note/>
</trans-unit>
<trans-unit id="openLinkCommand|ButtonText">
<source>Open on GitHub</source>
<target xml:lang="zh-CN" state="needs-translation">Open on GitHub</target>
<note/>
</trans-unit>
<trans-unit id="openLinkCommand|LocCanonicalName">
<source>.GitHub.OpenLink</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.OpenLink</target>
<note/>
</trans-unit>
<trans-unit id="pullRequestCommand|ButtonText">
<source>Pull Requests</source>
<target xml:lang="zh-CN" state="translated">拉取请求</target>
<note/>
</trans-unit>
<trans-unit id="pullRequestCommand|LocCanonicalName">
<source>.GitHub.PullRequests</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.PullRequests</target>
<note/>
</trans-unit>
<trans-unit id="refreshCommand|ButtonText">
<source>Refresh</source>
<target xml:lang="zh-CN" state="translated">刷新</target>
<note/>
</trans-unit>
<trans-unit id="refreshCommand|LocCanonicalName">
<source>.GitHub.Refresh</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.Refresh</target>
<note/>
</trans-unit>
<trans-unit id="showCurrentPullRequestCommand|ButtonText">
<source>Show Current Pull Request</source>
<target xml:lang="zh-CN" state="translated">显示当前推送请求</target>
<note/>
</trans-unit>
<trans-unit id="showCurrentPullRequestCommand|LocCanonicalName">
<source>.GitHub.ShowCurrentPullRequest</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.ShowCurrentPullRequest</target>
<note/>
</trans-unit>
<trans-unit id="showGitHubPaneCommand|ButtonText">
<source>GitHub</source>
<target xml:lang="zh-CN" state="translated">GitHub</target>
<note/>
</trans-unit>
<trans-unit id="showGitHubPaneCommand|LocCanonicalName">
<source>.GitHub.ShowGitHubPane</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.ShowGitHubPane</target>
<note/>
</trans-unit>
<trans-unit id="syncSubmodulesCommand|ButtonText">
<source>Sync Submodules</source>
<target xml:lang="zh-CN" state="needs-translation">Sync Submodules</target>
<note/>
</trans-unit>
<trans-unit id="syncSubmodulesCommand|LocCanonicalName">
<source>.GitHub.SyncSubmodules</source>
<target xml:lang="zh-CN" state="needs-translation">.GitHub.SyncSubmodules</target>
<note/>
</trans-unit>
</body>
</file>
</xliff>
17 changes: 17 additions & 0 deletions src/GitHub.VisualStudio/xlf/VSPackage.zh-CN.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-CN" original="../VSPackage.resx">
<body>
<trans-unit id="110">
<source>GitHub.VisualStudio</source>
<target xml:lang="zh-CN" state="needs-translation">GitHub.VisualStudio</target>
<note/>
</trans-unit>
<trans-unit id="112" approved="yes">
<source>A Visual Studio Extension that brings the GitHub Flow into Visual Studio.</source>
<target xml:lang="zh-CN" state="translated">这是一个将GitHub工作流引入Visual Studio的扩展。</target>
<note/>
</trans-unit>
</body>
</file>
</xliff>