.net - "Switching" different cultures in C# code -
i writing own timespan
readablestring implementation. need support different languages.
a functional class implemented static class 2 static public methods, both called convert, 1 receives timespan value parameter, whereas second 1 allows provide cultureinfo
in order specify, desired readable string language.
my question idea use basic switch(desiredculture.threeletterisolanguagename) , return different string.format results.
is approach, given simple task trying solve? using threeletteriso anyhow more reliable , wide-spread 2 letter codes languages?
it seems me don't want localize timespan
, want localize whole application. there several ways how (for example, there weird, overcomplicated way specific wpf).
but preferred way use resource files. can have 1 culture-neutral resource file (e.g. text.resx
) , 1 resource each culture want support (e.g. text.de.resx
german). if there no resource set culture, culture-neutral 1 used.
visual studio has editor resource files, making translation relatively simple.
additionally, might give more details: walkthrough: using resources localization asp.net (but resources not specific asp.net).
Comments
Post a Comment