#1,129 – Localization X – Integrating Translations Back into Application

Once you get localized resources back from the translation team, you need to integrate these localized resources back into your application.

To integrate localized changes, once you have the new .csv file containing localized resources, do the following:

  • Open a Visual Studio command prompt
  • Change directory to be directory containing main application .exe file (e.g. \bin\Release)
  • Copy .csv file containing translations into this directory (e.g. WpfApplication1.resources.fr-FR.csv)
  • Create a sub-directory matching the desired culture name  (e.g. fr-FR)
  • Ensure that locbaml.exe is also present in this directory
  • Execute this command: locbaml.exe /generate .\en-US\WpfApplication1.resources.dll /trans:.\WpfApplication1.resources.fr-FR.csv /out:.\fr-FR /cul:fr-FR

You should see a new WpfApplication1.resources.dll file in the fr-FR sub-directory.

Advertisements

#1,127 – Localization VIII – Passing Comments On to the Translator

When you have an application that will be localizable, you use localization attributes to explicitly mark which elements need to be localized.  You may want to also add a comment for a particular element, to help the translator in localizing the content.

You can add a comment for the translator in a XAML file using the Localization.Comments attribute.  The property can contain comments for multiple attributes and the comments will be written to the .csv file with the corresponding attribute.

Below, we specify a comment to be associated with the Content property.

        <Button x:Uid="Button_1" Content="Learn More" Margin="5"
                Click="Button_Click"
                Localization.Attributes="$Content(Unmodifiable) Margin(Unmodifiable)"
                Localization.Comments="Content(Should be an imperative--a command)"/>

Now, after generating the .csv file with LocBaml, we see that the comment shows up.

1127-001

#1,125 – Localization VI – Interpreting CSV File That Is Output by LocBaml Tool

As part of the localization process, you can use the LocBaml tool to extract localizable content into a text-based .csv file.

Below is a snapshot of a sample .csv file containing localizable content.

1124-001

Each line in the .csv file represents a single property of some user interface element.  The line contains the following elements (separated by commas):

  • The name of the BAML resource containing the property
    • (e.g. WpfApplication1.g.en-US.resources:mainwindow.baml)
  • Fully qualified property name, including the element’s UID
    • (e.g. Label_1:System.Windows.Controls.ContentControl.Content)
  • Localization category  (e.g. Button, Label, Text, etc).
  • Whether property is visible to user (T/F).
  • Whether property can or should be modified by translator (T/F)  (defaults to true for all elements)
  • Comments provided for translator  (defaults to blank)
  • Property value  (the thing that should be localized)

#1,124 – Localization V – Extracting Localizable Content Using LocBaml

Once you’ve generated UIDs for user interface elements and obtained the LocBaml tool, the next step in the localization process is to extract localizable content from the BAML data in your compiled DLL.

The steps are as follows:

  • Copy the locbaml.exe into the same directory as your application’s .exe file
  • Open a Visual Studio 2013 command prompt
  • Navigate to directory containing your .exe (e.g. \bin\Release, with \en-US sub-directory containing satellite assembly)
  • Enter: locbaml.exe /parse .\en-US\[application].resources.dll  (where en-US is the default culture)

After running this command, you’ll see a .csv file show up in the same directory (e.g. WpfApplication1.resources.csv).  The CSV file will contain a list of localizable content.

1124-001

#1,123 – Localization IV – Download and Build the LocBaml Tool

After generating UIDs for all user interface elements in your project, the next step is to extract elements that need to be localized (i.e. given values for a specific language) into an external file.  This file can be passed to people doing the localization.

To extract localizable data, you need a tool called LocBaml.  This tool is made available by Microsoft, but not distributed with Visual Studio.

To get a copy of the LocBaml tool:

  • Download LocBaml project (for .NET 4) from here
  • Open LocBaml project and rebuild using Release|x86 configuration, targeting a .NET Framework version that matches your main project