Adding a Resource File Template and String Variables

Add a resource file template to the project and then edit the template with the XML Designer to define localizable strings that appear in dialog boxes and error messages.

  1. In the Project menu, select Add New Item.
  2. In the Templates box, select the Resources File template. Enter the file name "SampleApp.resx" in the Name box.

    The resources file template contains resources that are accessed when the application cannot find resources appropriate to the user interface culture.

    The file gets added to your project in Solution Explorer and automatically opens in the XML Designer in Data view.

  3. In the Data pane, select an empty row and enter "strDatabaseDeleted" in the name column and "Database deleted" in the value column.
  4. Add rows for other strings, as required.
    Note: You do not need to specify the type or mimetype for a string; strings are used for objects. The type specifier holds the data type of the object being saved. The MIME type specifier holds the base type (base64) of the binary information stored, if the object consists of binary data.
  5. In the File menu, select Save SampleApp.resx.
  6. Repeat this procedure to create resource files for the other languages.
    For example, we may create an additional resource file named "SampleApp.zh-CHS.resx". That file is to contain resources that are specific to Chinese as spoken in Chinese (Simplified).