Changes between Version 6 and Version 7 of Internationalization


Ignore:
Timestamp:
Mar 22, 2011, 3:21:23 PM (11 years ago)
Author:
krauss
Comment:

Corrected some typos

Legend:

Unmodified
Added
Removed
Modified
  • Internationalization

    v6 v7  
    1414
    1515First you have to externalize all the strings in your project that you want to translate.
    16 This means, that you want to redirect the access of these to strings to a resource file.
     16This means, that you want to redirect the access of these strings to a resource file.
    1717When having multiple versions of this resource file (e.g. german and english), CrypTool will automatically choose the strings in the current language.
    1818
     
    2323
    2424When starting to externalize, you first need a resource file.
    25 If 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.
    26 Than click on the appearing label to generate you resource file.
     25If you don't already have one (which is the case for most plugin projects), you can create one by going to your project properties and choose the tab "Resources" on the left side.
     26Then click on the appearing label to generate your resource file.
    2727
    2828[[Image(createResourceFile.png)]]
     
    4242[[Image(codeExt1.png)]]
    4343
    44 First, 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.
     44First, what annoys us here, is the string concatenation. We don't want to externalize this as two separate strings, especially because it makes translating these strings harder.
    4545So we make use of the string.Format feature of .Net, by changing the code to the following:
    4646{{{
     
    7272Externalizing strings from XAML is much harder, especially because ReSharper can't help you very much here (mostly because it seems to have a lot of bugs in its XAML externalizing functionality).
    7373
    74 First 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:
     74First you have to find out, in which namespace your resource class lies. You can do this by opening the Resources.Designer.cs class and take a look:
    7575
    7676[[Image(XAMLExt1.png)]]
     
    9090[[Image(XAMLExt2.png)]]
    9191
    92 Now 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").
     92Now 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 Attributes like "Name" or "Visiblity").
    9393
    9494Lets assume you want to externalize the following text attribute:
     
    100100<TextBlock Width="117.812" Height="29.237" Canvas.Left="112.482" Text="{Loc Encryption}" TextWrapping="Wrap" FontSize="24"/>
    101101}}}
    102 Now instead of setting the string "Encryption" directly, XAML gets the string from you resource file under the key "Encryption".
     102Now instead of setting the string "Encryption" directly, XAML gets the string from your resource file under the key "Encryption".
    103103So 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")
    104104You can do this by opening your project settings and clicking the "Resources" tab. It shows you all entries. Simply add your new one:
     
    138138
    139139== Translating the resource file ==
    140 When you externalized all strings, you can start translating them.
     140When you have externalized all strings, you can start translating them.
    141141Let's assume that your resources file is located in Properties -> Resources.resx:
    142142