Last active
September 9, 2018 08:12
-
-
Save bezysoftware/690361d1ae2f4393bf5ea8162731a2bc to your computer and use it in GitHub Desktop.
Resx designer sample
This file contains hidden or 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
| 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