Changes between Version 2 and Version 3 of Internationalization


Ignore:
Timestamp:
Feb 5, 2011, 1:16:04 PM (11 years ago)
Author:
Sven Rech
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Internationalization

    v2 v3  
    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):
    3838[[Image(codeExt1.png)]]
     39
    3940First, 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.
    4041So we make use of the string.Format feature of .Net, by changing the code to the following:
     
    5152Press enter (to choose the "Move to Resource..." feature). A ReSharper Dialog will open now:
    5253[[Image(codeExt3.png)]]
     54
    5355You should take special care of the proposed name and the selected Resource file.
    5456The name can't contain special characters like whitespaces. It follows the same rules as variable name in .Net.
     
    6668First 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:
    6769[[Image(XAMLExt1.png)]]
     70
    6871So in the example, we know now, that our Resource class has the following path:
    6972{{{
     
    9396[[Image(XAMLExt4.png)]]
    9497
    95 === Externalizing MetaInformation strings ===
    96 TODO
     98=== Externalizing metainformation strings ===
     99By metainformations, I mean those strings, that are passed to CrypWin passively by attributes (e.g. the name and description of the plugin).
     100
     101First you have to change your PluginInfoAttribute so that it contains your resource class path.
     102For instance, when using the RSA class as an example, you must change
     103{{{
     104[PluginInfo(false, "RSA", "RSA En/Decryption", "RSA/DetailedDescription/Description.xaml", "RSA/iconrsa.png", "RSA/Images/encrypt.png", "RSA/Images/decrypt.png")]
     105}}}
     106to this:
     107{{{
     108[PluginInfo("RSA.Properties.Resources", false, "RSAcaption", "RSAtooltip", "RSA/DetailedDescription/Description.xaml", "RSA/iconrsa.png", "RSA/Images/encrypt.png", "RSA/Images/decrypt.png")]
     109}}}
     110What happened here? We inserted a new parameter in the begining, which describes the path to the resource class (Check out the XAML section to learn how to find this path out).
     111Furthermore, we replaced the caption and tooltip parameter by keys in the resource file.
     112
     113Consequently, you have to add two new entries into your resource file:
     114[[Image(MetaExt1.png)]]
     115
     116Now you can replace all other meta information strings with resource keys.
     117For instance, if we want to externalize the name and description of the InputText plugin input:
     118[[Image(MetaExt2.png)]]
     119
     120Change the attribute to:
     121{{{
     122[PropertyInfo(Direction.InputData, "inputTextName", "inputTextDescription", "")]
     123}}}
     124and create two new corresponding entries in the resource file.
     125
    97126
    98127== Translating the resource file ==