Changes between Version 1 and Version 2 of Internationalization


Ignore:
Timestamp:
Feb 5, 2011, 12:56:36 PM (11 years ago)
Author:
Sven Rech
Comment:

pictues too large, I will fix this later

Legend:

Unmodified
Added
Removed
Modified
  • Internationalization

    v1 v2  
    2323If you don't already have one (which is the case for must plugin projects), you can create one by going to you project properties and choose the tab "Resources" on the left side.
    2424Than click on the appearing label to generate you resource file.
    25 IMAGE HERE
     25[[Image(createResourceFile.png)]]
    2626
    2727Now you need to externalize three things:
     
    3636
    3737For instance, I want to externalize the following string from the RSA class (I know I just said, that externalizing GuiLogMessages is not needed, but this is a very good example anyway):
    38 IMAGE HERE
     38[[Image(codeExt1.png)]]
    3939First, what annoys us here, is the string concatenation. We don't want to externalize this as two seperat strings, especially because it makes translating these strings harder.
    4040So we make use of the string.Format feature of .Net, by changing the code to the following:
     
    4747
    4848After that, we can externalize the string. Move your cursor over the string. Then simply press Ctrl+Shift+R. The following should happen:
    49 IMAGE HERE
     49[[Image(codeExt2.png)]]
     50
    5051Press enter (to choose the "Move to Resource..." feature). A ReSharper Dialog will open now:
    51 IMAGE HERE
     52[[Image(codeExt3.png)]]
    5253You should take special care of the proposed name and the selected Resource file.
    5354The name can't contain special characters like whitespaces. It follows the same rules as variable name in .Net.
     
    6465
    6566First you have to find out, in which namespace you resource class lies. You can do this by opening the Resources.Designer.cs class and take a look:
    66 IMAGE HERE
     67[[Image(XAMLExt1.png)]]
    6768So in the example, we know now, that our Resource class has the following path:
    6869{{{
     
    7677}}}
    7778Here, you should replace RESOURCECLASSPATH by the above obtained resource class path:
    78 IMAGE HERE
     79[[Image(XAMLExt2.png)]]
    7980
    8081Now your xaml file is ready to be externalized. Open the the .xaml file and watch out for all strings you want to externalize (Of course, you DON'T want to externalize things Attribtes like "Name" or "Visiblity").
    8182
    8283Lets assume you want to externalize the following text attribute:
    83 IMAGE HERE
     84[[Image(XAMLExt3.png)]]
    8485
    8586Simply replace this by:
     
    9091So you have to create a new entry in your resource file with the key "Encryption" and the value "Encryption" (of course again you must take care that your key does not contain special characters. So when externalizing the string "Hello World", the key can be named something like "Hello_World")
    9192You can do this by opening your project settings and clicking the "Resources" tab. It shows you all entries. Simply add your new one:
    92 IMAGE HERE
     93[[Image(XAMLExt4.png)]]
    9394
    9495=== Externalizing MetaInformation strings ===