Skip to content

Instantly share code, notes, and snippets.

@bezysoftware
Last active September 9, 2018 08:12
Show Gist options
  • Select an option

  • Save bezysoftware/690361d1ae2f4393bf5ea8162731a2bc to your computer and use it in GitHub Desktop.

Select an option

Save bezysoftware/690361d1ae2f4393bf5ea8162731a2bc to your computer and use it in GitHub Desktop.
Resx designer sample
namespace SettleUp.Localization.Resources
{
public class AppResources
{
// Resource manager for accessing the ResX resources
public global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
// notice the AppResource's full path - you will want to change this to suit you
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SettleUp.Localization.Resources.AppResources", typeof(AppResources).Assembly);
this.resourceMan = temp;
}
return resourceMan;
}
}
// you can override default culture
public global::System.Globalization.CultureInfo Culture {
get { return this.resourceCulture; }
set { this.resourceCulture = value; }
}
// localized resources
public string SomeString => ResourceManager.GetString("some_string", this.resourceCulture);
// ... other localized strings
}
}
// using this in code-behind
private void ButtonClick(object sender, EventArgs args)
{
this.textBlock.Text = AppResources.Instance.SomeString;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment