Created
July 15, 2011 00:46
-
-
Save sergiogarciadev/1083816 to your computer and use it in GitHub Desktop.
Small class to help handling working with diferent locales in the same system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GinxCultureHelper : IDisposable | |
{ | |
private readonly CultureInfo _currentUiCulture; | |
private readonly CultureInfo _currentCulture; | |
public GinxCultureHelper(string cultureName) | |
{ | |
_currentCulture = Thread.CurrentThread.CurrentCulture; | |
_currentUiCulture = Thread.CurrentThread.CurrentUICulture; | |
var culture = new CultureInfo(cultureName); | |
Thread.CurrentThread.CurrentCulture = culture; | |
Thread.CurrentThread.CurrentUICulture = culture; | |
} | |
public void Dispose() | |
{ | |
Thread.CurrentThread.CurrentCulture = _currentCulture; | |
Thread.CurrentThread.CurrentUICulture = _currentUiCulture; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment