Changes between Version 2 and Version 3 of Internationalization

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



  • 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):
    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:
    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:
    6871So in the example, we know now, that our Resource class has the following path:
    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).
     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
     104[PluginInfo(false, "RSA", "RSA En/Decryption", "RSA/DetailedDescription/Description.xaml", "RSA/iconrsa.png", "RSA/Images/encrypt.png", "RSA/Images/decrypt.png")]
     106to this:
     108[PluginInfo("RSA.Properties.Resources", false, "RSAcaption", "RSAtooltip", "RSA/DetailedDescription/Description.xaml", "RSA/iconrsa.png", "RSA/Images/encrypt.png", "RSA/Images/decrypt.png")]
     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.
     113Consequently, you have to add two new entries into your resource file:
     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:
     120Change the attribute to:
     122[PropertyInfo(Direction.InputData, "inputTextName", "inputTextDescription", "")]
     124and create two new corresponding entries in the resource file.
    98127== Translating the resource file ==