public PropertyWrapper(string propertyName, T defaultValue) { this.propertyName = propertyName; value = PropertyService.Get(propertyName, defaultValue); }
static GettextCatalog() { mainThread = Thread.CurrentThread; //variable can be used to override where Gettext looks for the catalogues string catalog = Environment.GetEnvironmentVariable("MONODEVELOP_LOCALE_PATH"); // Set the user defined language string lang = PropertyService.Get("MonoDevelop.Ide.UserInterfaceLanguage", ""); if (!string.IsNullOrEmpty(lang)) { if (Platform.IsWindows) { lang = lang.Replace("_", "-"); CultureInfo ci = CultureInfo.GetCultureInfo(lang); if (ci.IsNeutralCulture) { // We need a non-neutral culture foreach (CultureInfo c in CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures)) { if (c.Parent != null && c.Parent.Name == ci.Name) { ci = c; break; } } } if (!ci.IsNeutralCulture) { SetThreadUILanguage(ci.LCID); mainThread.CurrentUICulture = ci; } } else { Environment.SetEnvironmentVariable("LANGUAGE", lang); } } if (string.IsNullOrEmpty(catalog) || !Directory.Exists(catalog)) { string location = System.Reflection.Assembly.GetExecutingAssembly().Location; location = Path.GetDirectoryName(location); if (Platform.IsWindows) { // On windows, load the catalog from a child dir catalog = Path.Combine(location, "locale"); } else { // MD is located at $prefix/lib/monodevelop/bin // adding "../../.." should give us $prefix string prefix = Path.Combine(Path.Combine(Path.Combine(location, ".."), ".."), ".."); if (Platform.IsMac) { prefix = Path.Combine(prefix, "..", "MacOS"); } //normalise it prefix = Path.GetFullPath(prefix); //catalogue is installed to "$prefix/share/locale" by default catalog = Path.Combine(Path.Combine(prefix, "share"), "locale"); } } try { Catalog.Init("monodevelop", catalog); } catch (Exception ex) { Console.WriteLine(ex); } }