本地化资源.NET - 如何使它们保持同步?

时间:2023-01-15 09:32:13

When we follow localization guidelines we endup with at least a couple of resource files.

当我们遵循本地化指南时,我们至少会使用几个资源文件。

Resource.resx and Resource.CI.resx which is a specific CultureInfo resource. Lets say we add a hundred string pairs in Resource.resx and want to translate those keys in another resource. we can copy paste them right now and translate them and it might work the first time.

Resource.resx和Resource.CI.resx是一个特定的CultureInfo资源。假设我们在Resource.resx中添加了一百个字符串对,并希望在另一个资源中转换这些键。我们现在可以复制粘贴它们并翻译它们,这可能是第一次使用。

However after we translate strings it becomes hard to keep files synchronized - it reorders strings automatically and I currently don't understand what is the supposed way to make sure each string is localized.

然而,在我们翻译字符串后,很难保持文件同步 - 它会自动重新排序字符串,而我目前还不明白确定每个字符串是否已本地化的假设方式。

Since resource strings are supposed to be kind of linked with each other and with extra job that is done to make sure satellite assemblies are built correctly I was hoping theres a function like 'make sure each resource string is present in localized resource file' but I am afraid that one is missing..

由于资源字符串应该是彼此链接的,并且为确保附属程序集正确构建而执行额外的工作,我希望有一个函数,例如“确保每个资源字符串都存在于本地化资源文件中”,但我我担心一个人失踪..

8 个解决方案

#1


6  

RESX Synchroniser might do you what you are looking for

RESX Synchroniser可能会为您提供所需的服务

When you edit the .NET Resource files in Visual Studio, either manually and using the "Generate Local Resources" command, the IDE updates only the culture-invariant resources: if you have a resource file called Messages.aspx, the files in other languages, say Messages.it-IT.resx, are not updated, and you have to do that manually. RESX Synchronizer will help you keep the resource files synchronized, adding the new keys to the localized files, and removing the deleted ones. Comments are preserved during the process.

在Visual Studio中编辑.NET资源文件时,手动并使用“生成本地资源”命令,IDE仅更新文化不变资源:如果您有一个名为Messages.aspx的资源文件,则使用其他语言编写的文件,例如Messages.it-IT.resx,不会更新,您必须手动执行此操作。 RESX Synchronizer将帮助您保持资源文件同步,将新密钥添加到本地化文件,并删除已删除的文件。在此过程中保留评论。

#2


4  

I just found http://zetaresourceeditor.codeplex.com/ as well seems like a similar idea to the others

我刚刚发现http://zetaresourceeditor.codeplex.com/似乎与其他人的想法相似

#3


2  

may be UnitTest can help you? you know, which text each control should have, once you create them, after just add new strings to list and compare the values. after once hard working you can test your localization works right.

可能是UnitTest可以帮到你吗?你知道,每个控件应该有哪个文本,一旦你创建它们,只需添加新的字符串列表并比较值。一旦努力工作,您可以测试您的本地化工作正确。

#4


1  

I know this has already been given traditional answers, but I would also like to put forward something completely original we tried (and succeeded) doing ourselves for more efficient localisation of Silverlight:

我知道这已经得到了传统的答案,但我还想提出一些完全原创的东西,我们尝试(并成功)为自己做更有效的Silverlight本地化:

Localisation of Silverlight projects after completion

完成后Silverlight项目的本地化

(Resx is so "last century")

(Resx是如此“上个世纪”)

#5


1  

I suggest you create culture specific resource files programmatically using the Resx file for that Winform. You can create a small app which you could run time to time.

我建议您使用该Winform的Resx文件以编程方式创建特定于文化的资源文件。您可以创建一个可以不时运行的小应用程序。

Create XML kind of file for each culture like fr.XML, fill that with the Union of all the strings in your project.And provide the translations there itself like, for example that file in french might look like the following..

为fr.XML等每种文化创建XML类型的文件,用项目中所有字符串的Union填充它。并在那里提供翻译,例如法语文件可能如下所示。

< wordTranslation>
< Word>Hello< /Word>
< Translation>Bonjour< /Translation>
< /wordTranslation>

Create a hashtable or some data structure which would best act as dictionary for each culture, fill it with data from the culture specific XMl files like frDictionary.

创建一个哈希表或一些数据结构,最好充当每种文化的字典,用文化特定的XMl文件(如frDictionary)填充数据。

For Each Resx file in your project for example wind1.resx , create a culture specific file like wind1.fr.resx. Read words from wind1.resx, find the translation of the word from the frDictionayry. Write it to wind1.fr.resx.

对于项目中的每个Resx文件,例如wind1.resx,创建一个特定于文化的文件,例如wind1.fr.resx。从wind1.resx中读取单词,从frDictionayry中找到单词的翻译。把它写到wind1.fr.resx。

You can keep updating your translations in the XML file. So its a one time effort. This way you can keep it synchornised and easily maintainable.

您可以继续在XML文件中更新您的翻译。所以这是一次性的努力。通过这种方式,您可以保持同步并轻松维护。

#6


0  

You mean synchronize translations between those files? Use http://www.getlocalization.com and upload both as master files, when they are translated the translations are populated to all your files.

你的意思是同步这些文件之间的翻译?使用http://www.getlocalization.com并将两者作为主文件上传,翻译后,翻译将填充到您的所有文件中。

#7


0  

I think you can try Amanuens. It's developed by the same author of RESX Synchronizer and besides help keeping resource files synchronized (even automatically into your repository if you set it), can be used to give your translators access to strings to be translated in a very powerful and easy to use web editor.

我想你可以试试Amanuens。它由RESX Synchronizer的同一作者开发,除了帮助保持资源文件同步(如果你设置它甚至自动进入你的存储库),可以用来让你的翻译人员访问要在非常强大和易于使用的网页中翻译的字符串编辑。

#8


0  

a little old this discussion, but still interesting. have a look at ResXManager

这个讨论有点老了,但仍然很有趣。看看ResXManager

#1


6  

RESX Synchroniser might do you what you are looking for

RESX Synchroniser可能会为您提供所需的服务

When you edit the .NET Resource files in Visual Studio, either manually and using the "Generate Local Resources" command, the IDE updates only the culture-invariant resources: if you have a resource file called Messages.aspx, the files in other languages, say Messages.it-IT.resx, are not updated, and you have to do that manually. RESX Synchronizer will help you keep the resource files synchronized, adding the new keys to the localized files, and removing the deleted ones. Comments are preserved during the process.

在Visual Studio中编辑.NET资源文件时,手动并使用“生成本地资源”命令,IDE仅更新文化不变资源:如果您有一个名为Messages.aspx的资源文件,则使用其他语言编写的文件,例如Messages.it-IT.resx,不会更新,您必须手动执行此操作。 RESX Synchronizer将帮助您保持资源文件同步,将新密钥添加到本地化文件,并删除已删除的文件。在此过程中保留评论。

#2


4  

I just found http://zetaresourceeditor.codeplex.com/ as well seems like a similar idea to the others

我刚刚发现http://zetaresourceeditor.codeplex.com/似乎与其他人的想法相似

#3


2  

may be UnitTest can help you? you know, which text each control should have, once you create them, after just add new strings to list and compare the values. after once hard working you can test your localization works right.

可能是UnitTest可以帮到你吗?你知道,每个控件应该有哪个文本,一旦你创建它们,只需添加新的字符串列表并比较值。一旦努力工作,您可以测试您的本地化工作正确。

#4


1  

I know this has already been given traditional answers, but I would also like to put forward something completely original we tried (and succeeded) doing ourselves for more efficient localisation of Silverlight:

我知道这已经得到了传统的答案,但我还想提出一些完全原创的东西,我们尝试(并成功)为自己做更有效的Silverlight本地化:

Localisation of Silverlight projects after completion

完成后Silverlight项目的本地化

(Resx is so "last century")

(Resx是如此“上个世纪”)

#5


1  

I suggest you create culture specific resource files programmatically using the Resx file for that Winform. You can create a small app which you could run time to time.

我建议您使用该Winform的Resx文件以编程方式创建特定于文化的资源文件。您可以创建一个可以不时运行的小应用程序。

Create XML kind of file for each culture like fr.XML, fill that with the Union of all the strings in your project.And provide the translations there itself like, for example that file in french might look like the following..

为fr.XML等每种文化创建XML类型的文件,用项目中所有字符串的Union填充它。并在那里提供翻译,例如法语文件可能如下所示。

< wordTranslation>
< Word>Hello< /Word>
< Translation>Bonjour< /Translation>
< /wordTranslation>

Create a hashtable or some data structure which would best act as dictionary for each culture, fill it with data from the culture specific XMl files like frDictionary.

创建一个哈希表或一些数据结构,最好充当每种文化的字典,用文化特定的XMl文件(如frDictionary)填充数据。

For Each Resx file in your project for example wind1.resx , create a culture specific file like wind1.fr.resx. Read words from wind1.resx, find the translation of the word from the frDictionayry. Write it to wind1.fr.resx.

对于项目中的每个Resx文件,例如wind1.resx,创建一个特定于文化的文件,例如wind1.fr.resx。从wind1.resx中读取单词,从frDictionayry中找到单词的翻译。把它写到wind1.fr.resx。

You can keep updating your translations in the XML file. So its a one time effort. This way you can keep it synchornised and easily maintainable.

您可以继续在XML文件中更新您的翻译。所以这是一次性的努力。通过这种方式,您可以保持同步并轻松维护。

#6


0  

You mean synchronize translations between those files? Use http://www.getlocalization.com and upload both as master files, when they are translated the translations are populated to all your files.

你的意思是同步这些文件之间的翻译?使用http://www.getlocalization.com并将两者作为主文件上传,翻译后,翻译将填充到您的所有文件中。

#7


0  

I think you can try Amanuens. It's developed by the same author of RESX Synchronizer and besides help keeping resource files synchronized (even automatically into your repository if you set it), can be used to give your translators access to strings to be translated in a very powerful and easy to use web editor.

我想你可以试试Amanuens。它由RESX Synchronizer的同一作者开发,除了帮助保持资源文件同步(如果你设置它甚至自动进入你的存储库),可以用来让你的翻译人员访问要在非常强大和易于使用的网页中翻译的字符串编辑。

#8


0  

a little old this discussion, but still interesting. have a look at ResXManager

这个讨论有点老了,但仍然很有趣。看看ResXManager