AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

[Localization] Missing steps for generating and editing resx on Linux and Mac

Open tanaka-takayoshi opened this issue 8 years ago • 56 comments

We need to generate and edit in localization. However the document describes the steps only on the Visual Studio on Windows. Now ASP.NET Core is cross platform so could you describe the supported steps on Linux and Mac OS.

At least, the document should describe the XML schema and the sample XML for resx.

Edit by @Rick-Anderson : See LocalizationResourceGenerator which generates & translates resources based on default <resource>.resx


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

tanaka-takayoshi avatar Jan 12 '17 03:01 tanaka-takayoshi

Tooling for VS Code or VS for Mac? @sayedihashimi @madskristensen

spboyer avatar Jan 12 '17 16:01 spboyer

@spboyer I'm not aware of any tooling for those SKUs regarding .resx files. That's not to say that there aren't any

madskristensen avatar Jan 12 '17 16:01 madskristensen

@ryanbrandenburg @DamianEdwards How do Visual Studio for Code folks generate/edit .resx files?

Rick-Anderson avatar Jan 12 '17 20:01 Rick-Anderson

@tanaka-takayoshi can you try How to edit a .resx file on Mac OS

Rick-Anderson avatar Jan 13 '17 18:01 Rick-Anderson

@Rick-Anderson Thanks. I'm not a Mac user but Linux user. However, it appears working on Linux. I'll try later and report.

tanaka-takayoshi avatar Jan 14 '17 06:01 tanaka-takayoshi

@Rick-Anderson I tried it, but there are some problems.

  1. POEditor on Linux doesn't have a function to import resx and add a localization term from scratch. It intends to import localization terms from souce code directly, but it doesn't work for ASP.NET Core codes.

  2. http://converter.webtranslateit.com/ has other supported format. I tried CSV. But it can't convert the resource whose key contains space. So, for example, such term can't convert CSV to resx. https://github.com/aspnet/Entropy/blob/rel/1.1.0/samples/Localization.StarterWeb/Resources/Views.Home.About.fr.resx#L123

Now, as far as https://msdn.microsoft.com/en-us/library/ekyft91f(v=vs.100).aspx is the formal schema for resource file, only supported way on Linux and Mac OSX is editing resx file directly as plain XML file. I'll try to create VS Code extension for editing resx file or dotnet cli extension for converting to resx from some kind of files (like csv).

tanaka-takayoshi avatar Jan 15 '17 03:01 tanaka-takayoshi

@tanaka-takayoshi Thanks for the update.

Rick-Anderson avatar Jan 15 '17 05:01 Rick-Anderson

I think that this may be a bug for tooling for xplat and not for docs.

@danroth27

spboyer avatar Jan 17 '17 14:01 spboyer

@danroth27 @DamianEdwards Will VS for Mac solve this for the Mac? What about Linux?

Rick-Anderson avatar Mar 20 '17 20:03 Rick-Anderson

@DamianEdwards How do Visual Studio for Code folks generate/edit .resx files? Will VS for Mac solve this for the Mac? What about Linux?

Rick-Anderson avatar Mar 28 '17 18:03 Rick-Anderson

Any news on this?

NinoFloris avatar Sep 17 '17 21:09 NinoFloris

After looking to too many articles I have installed the visual studio community edition on Windows. It seems that the utility tool (https://docs.microsoft.com/es-es/dotnet/framework/tools/resgen-exe-resource-file-generator?view=netframework-4.7.1) for generating .resources from .restext , .txt or resx is, unfortunately, only installed by installing Visual studio

rminon avatar Mar 15 '18 06:03 rminon

@VanKichline where can we open an issue on this for Visual Studio for Mac. Linux needs a solution too. This is an essential tool.

We really need an xplat tool for this.

@tanaka-takayoshi have you found any workarounds?

Rick-Anderson avatar Mar 15 '18 22:03 Rick-Anderson

@Rick-Anderson Though I haven't checked the recent updates regarding this issue, my previous comment might be still valid. https://github.com/aspnet/Docs/issues/2501#issuecomment-272670895

At first, we need a template file for resource file, which can be generated by Visual Studio. So we need Visual Studio (on Windows) for the first time. Once a resource file is created, we can copy it to Linux/Mac and simply edit the file.

ASP.NET Core team might have to clarify the XML scheme for the resource file. Once XML scheme is defined, we can create a resource file without Visual Studio. If XML scheme is same as one for .NET Framework, could you add to ASP.NET Core document as a specificastion?

tanaka-takayoshi avatar Mar 18 '18 03:03 tanaka-takayoshi

@ryanbrandenburg @DamianEdwards @danroth27 @rynowak This is our #1 request.

Rick-Anderson avatar Aug 03 '18 19:08 Rick-Anderson

@Andrew-MSFT Are there any plans to support generating/editing resx on xplat?

danroth27 avatar Aug 08 '18 05:08 danroth27

I remembered that I created a tool called LocalizationResourceGenerator which generate & translate resources based on default <resource>.resx, I think I will have a look again to support creating a .resx file from .restext , .txt or any popular format .. please your feedback is welcome

hishamco avatar Nov 28 '18 10:11 hishamco

@Andrew-MSFT Are there any plans to support generating/editing resx on xplat? cc @sayedihashimi

Rick-Anderson avatar Jan 19 '19 03:01 Rick-Anderson

FYI I update the tool that I created, so you can generate resx files from restext files, but still Visual Studio support will be great

hishamco avatar Jan 19 '19 17:01 hishamco

This is something we'd like to support eventually, but it's not on the roadmap in the .NET Core 3.0 time frame

AndrewBrianHall avatar Jan 23 '19 19:01 AndrewBrianHall

@AndrewBrianHall Now that .NET Core 3.0 has shipped and 3.1 is on the way, would you consider this item for the next release?

BrightSoul avatar Oct 26 '19 11:10 BrightSoul

I'm working on VS Code extension for editing resx files, hope to share it with you once it's ready

hishamco avatar Oct 26 '19 11:10 hishamco

FYI I'm still working on the extension, facing some issues in the UI part, hopefully I will find time to finish them and release a beta version

However you can use the CLI tool that I referred to above, your feedback is very important

hishamco avatar Dec 11 '19 14:12 hishamco

Hi All, i was having the issue where I needed resx files to generate designer.cs files from VS Code. The following tool helped me to do this: https://github.com/Taritsyn/ResxToCs. I just added the ResxToCs.MSBuild (nuget package) which added a build task to my csproj file and created designer.cs files each build.

One thing to mention is that the format of the translation to designer.cs file is different to how Visual studio translates it. For example the generated designer.cs files declared public properties rather than private (which is what visual studio does). So we had to modify our reflection code accordingly.

slnali avatar Apr 16 '20 16:04 slnali

@KathleenDollard

danroth27 avatar Apr 16 '20 17:04 danroth27

This extension seems to do the job.

knuxbbs avatar May 05 '20 01:05 knuxbbs

For now, the generation and manipulation of resource files is quite limited to the tools available on Windows (such as Resgen.exe). Even Visual Studio for Mac is unable to edit these files.

A truly cross-platform alternative to this issue would be to adopt Portable Objects (PO) to manage localization. This library seems to be a good starting point: https://github.com/VitaliiTsilnyk/NGettext

By the way, it costs nothing to mention that advances in this area are still outside the scope of .NET 5, as can be seen in this design proposal: https://github.com/dotnet/designs/pull/102

knuxbbs avatar May 05 '20 01:05 knuxbbs

@hishamco please review the VSC extension @knuxbbs mentions above. cc @KathleenDollard

Rick-Anderson avatar May 05 '20 01:05 Rick-Anderson

Sure, I was started on mine long time ago, but I was quite busy on some OSS especially after my left ankle was broken

hishamco avatar May 05 '20 02:05 hishamco

@Rick-Anderson I have a quick look, if you mean https://github.com/VitaliiTsilnyk/NGettext this is a library for PO files not resx, seems I need spend some time to finalize a first beta version of what I started unless VS Code or Visual Studio for Mac Team planned for something similar

hishamco avatar May 05 '20 02:05 hishamco