AspNetCore.Docs
AspNetCore.Docs copied to clipboard
[Localization] Missing steps for generating and editing resx on Linux and Mac
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.
- ID: d1833676-ff1b-c587-cc9c-81afffa8ef68
- Version Independent ID: ad989395-3f49-4d55-521e-cf6fe56281ee
- Content: Globalization and localization in ASP.NET Core
- Content Source: aspnetcore/fundamentals/localization.md
- Product: aspnet-core
- Technology: aspnetcore-fundamentals
- GitHub Login: @Rick-Anderson
- Microsoft Alias: riande
Tooling for VS Code or VS for Mac? @sayedihashimi @madskristensen
@spboyer I'm not aware of any tooling for those SKUs regarding .resx files. That's not to say that there aren't any
@ryanbrandenburg @DamianEdwards How do Visual Studio for Code folks generate/edit .resx files?
@tanaka-takayoshi can you try How to edit a .resx file on Mac OS
@Rick-Anderson Thanks. I'm not a Mac user but Linux user. However, it appears working on Linux. I'll try later and report.
@Rick-Anderson I tried it, but there are some problems.
-
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.
-
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 Thanks for the update.
I think that this may be a bug for tooling for xplat and not for docs.
@danroth27
@danroth27 @DamianEdwards Will VS for Mac solve this for the Mac? What about Linux?
@DamianEdwards How do Visual Studio for Code folks generate/edit .resx files? Will VS for Mac solve this for the Mac? What about Linux?
Any news on this?
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
@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 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?
@ryanbrandenburg @DamianEdwards @danroth27 @rynowak This is our #1
request.
@Andrew-MSFT Are there any plans to support generating/editing resx on xplat?
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
@Andrew-MSFT Are there any plans to support generating/editing resx on xplat? cc @sayedihashimi
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
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 Now that .NET Core 3.0 has shipped and 3.1 is on the way, would you consider this item for the next release?
I'm working on VS Code extension for editing resx files, hope to share it with you once it's ready
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
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.
@KathleenDollard
This extension seems to do the job.
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
@hishamco please review the VSC extension @knuxbbs mentions above. cc @KathleenDollard
Sure, I was started on mine long time ago, but I was quite busy on some OSS especially after my left ankle was broken
@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