Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's quite simple, actually. Create a new resource file, for example <code>Strings.resx</code>. Set <code>Access Modifier</code> to <code>Public</code>. Use the apprioriate file template, so Visual Studio will automatically generate an accessor class (the name will be <code>Strings</code>, in this case). This is your default language.</p> <p>Now, when you want to add, say, German localization, add a localized resx file. This will be typically <code>Strings.de.resx</code> in this case. If you want to add additional localization for, say, Austria, you'll additionally create a <code>Strings.de-AT.resx</code>.</p> <p>Now go create a string - let's say a string with the name <code>HelloWorld</code>. In your <code>Strings.resx</code>, add this string with the value "Hello, world!". In <code>Strings.de.resx</code>, add "Hallo, Welt!". And in <code>Strings.de-AT.resx</code>, add "Servus, Welt!". That's it so far.</p> <p>Now you have this generated <code>Strings</code> class, and it has a property with a getter <code>HelloWorld</code>. Getting this property will load "Servus, Welt!" when your locale is de-AT, "Hallo, Welt! when your locale is any other de locale (including de-DE and de-CH), and "Hello, World!" when your locale is anything else. If a string is missing in the localized version, the resource manager will automatically walk up the chain, from the most specialized to the invariant resource.</p> <p>You can use the <code>ResourceManager</code> class for more control about how exactly you are loading things. The generated <code>Strings</code> class uses it as well.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload