How to use xliff or po l10n formats in .net (C # / ASP.Net)

I studied the xliff and po i18n file formats and it seems they are widely used and supported. There are many free tools for managing translations in xliff / po files.

However, so far I have not been able to find a good solution on how to use xliff or po files in .net projects (C # / ASP.Net) . I would expect a kind of xliff/po => resx , but haven't found it yet.

However, at the same time, many tools support the conversion of xliff / po files to the java.properties format.

If you have experience implementing l10n through xliff or po files in .Net projects , please provide recommendations and share recommendations on how this works.

PS: I would prefer to use the xliff format, as I find it cleaner and more features, but po is also an option.

+7
source share
4 answers

PO and XLIFF files usually work differently:

  • PO files are resource files that are executed in binary format and then accessible through gettext () libraries. Sometimes PO is used as an extraction format, such as XLIFF, but this is not its original purpose.

  • XLIFFs are extraction files that are created by extracting a resource file (for example, resx) into XLIFF and then merged back to the original format.

therefore, for XLIFF, you should look for tools that execute resx -> xliff -> resx , not xlif -> resx .

Tools that extract / merge XLIFF files are commonly called filters. There are many commercial translation tools that will accept XLIFF, as well as some of them that can also create XLIFF (Swordfish, Trados Studio, etc.).

There are also some open source tools that can extract / combine XLIFF: File2XLIFF4j for example (but I don't think it supports resx).

Rainbow, from the Okapi project, supports resx. The "old" version of .net (Rainbow 5: Okapi on SourceForge) has a filter dedicated to the resx file and can handle them very well; even with binary data. It may run into a problem with third-party controls (see http://okapi.sourceforge.net/Release/Filters/Help/netres.htm for details).

The new version of java (Rainbow 6: http://code.google.com/p/okapi/ ) supports resx through its XML filter and works fine with simple resx, but if you have binary data, there is no text in these entries will be extracted.

-ys

+6
source

You can also consider the i18n package from Daniel Crenna , available from nuGet . It uses PO files as the default repository for localized text.

+10
source

I used .Net project management software after the .resx files started to get out of hand. I used it as an extraction format like XLIFF (see Yves comment ). Our existing .resx files were exported / merged once into one .po file for each language, which then became our authoritative language file from which all resx files were automatically generated.

The projects I'm working on are not ASP, so I don’t know about the package mentioned by mcw0933, but the Mono resgen.exe implementation has some simple conversion option po <=> resx. However, in order to preserve existing comments and automatically add the source text as additional comments, I have expanded the mono conversion tool to such an extent that the one I use is basically rewritten.

I put the extended .po <=> .resx converter on github .

As for choosing a .po for managing translations of a C # project,. Po is simple and friendly, but there are some inconveniences to use it in a way that is slightly different from its original use in gettext, and I have no experience to say if it was the best a choice than xliff, but the ability to manage translations and automate tasks was much better than dealing with resx files like we were in the past.

The minor inconvenience of using the software is slightly different from its intentions:

  • Since gettext uses msgid for double use as a field for storing the original untranslated string, I had to make a resgenEx archive of the original translation string into an attached comment instead of the field intended for this purpose.
  • Some tools assume that msgid will contain the original English translation (and not just the ID string), which may mean that the automatic error checking option of this tool is not very useful, or it may mean something that forces you to choose another tool and so on. .d. Most tools make no assumptions.
  • Some .po tools like \ n instead of \ r \ n

The project in which I originally wrote resgenEx had two .resx files and one .ISL file for each supported language, but soon I will need to manage all translations of the .Net project, which has several resx files for each class in the code. When this happens, I will decide if I should continue to use .po or use xliff or something else. If I continue to use .po, then I will clear resgenEx and maybe you need to add additional functions, for example, the ability to automatically add assembler names and class name prefixes in msgids.

+4
source

You can also try PhraseApp . PhraseApp is a translation management platform and supports a wide range of formats. Thus, you can download it in any format and export it again in the format that best suits your case, for example XLIFF, po or resx. Thus, you do not need to choose one translation format. And you can always easily switch to another format. PS: Full disclosure. I work on the PhraseApp team.

0
source

All Articles