.Net Library to parse PO files
I wanted to create a translator for PO files but I thought th开发者_JAVA百科at it's better to ask whether there is a library for .Net to parse .PO files or not.
Thanks.
The question is rather old so my answer is mainly for those who are looking for a PO parser .NET library nowadays.
I implemented a lightweight, fully-managed, .NET Standard-compatible library which is able to parse and generate PO files. Comments and plural translations are supported, as well. The library is free and open-source (released under the MIT license).
First you need to install the NuGet package:
Install-Package Karambolo.PO.Compact
Then to parse a PO file, you just need a few lines as follows:
var parser = new POParser();
POParseResult result;
using (var reader = new StreamReader("sample.po", Encoding.UTF8))
result = parser.Parse(reader);
if (result.Success)
{
POCatalog catalog = result.Catalog;
// process the parsed data...
}
else
{
IDiagnostics diagnostics = result.Diagnostics;
// examine diagnostics, display an error, etc...
}
For further details visit the project page.
You can use Mono.Unix
http://www.mono-project.com/I18N_with_Mono.Unix
精彩评论