As part of internationalizing our application which is based on asp.net, c#, silverlight, XBAP, I’m evaluating approaches to start with. I’m having to chose between GNU gettext()(PO files) and Microsoft’s resource(resx) based approach. So at this juncture, I’m trying to understand what is the best way to extract localizable strings from .cs files, aspx, ascx, xaml (silverlight) files to resource files(resx) automatically if I have to go the MS way.
I have below options in mind:
- Resource Refactoring tool, but it extracts all strings (no matter if you have to translate or not) like page headers etc. And we cannot mark or exclude particular strings. Or we will have to manually select each string and then extract (right click and click extract).
- Resharper’s Localization assistance, here I do not see the automatic extraction, but I’ll have to manually extract string by string.
I know there has to be a bit of manual intervention, but any advise would help in choosing the right direction, between gettext()(gnu gettext() c# or fairlylocal or MS localization approach.
Both the approaches have pros and cons, lets discuss.
FairlyLocal
(
GNU Gettext) first, initial tweaking is required:second, strings extraction has been taken care-of by
FairlyLocalitself.third, translation of strings could be done in-house or outsourced as PO files are widely known by
linguists. fourth, rendering of a few UTF-8 chars (if any) depend on webfonts {eot (trident), svg (webkit,gecko,presto)}. fifth, locale needs to be maintained (likepa-INlanguageCode-countryCode). sixth, several converters are available for PO files. seventh, the default logic will fall-back on default-locale (en-US) resources for the value. an issue, The .po files that the build script generates won’t be UTF8 by default. You’ll need to open them in POEdit (or similar) and explicitly change the encoding the first time you edit them if you want your translated text to correctly show special characters.MS localization
first, extraction of strings is pretty easy using
Resource Refactoring Tool. second, resgen.exe command-line tool could be used to make .resx fileslinguistsfriendly.third, Localization within .NET (not specific to ASP.NET Proper or ASP.NET MVC) implements a standard fallback mechanism. fourth, no dependency on
GNU Gettext Utils. fifth, can achieve localization fromStringstoDates,Currency, etc. using CurrentUICulture and CurrentCulture. sixth, webfonts are recommended here too.thanks.