Where to put source language resources

The source language is the language in which a piece of software has been developed.  Resources in this language can be placed in a main assembly, which will then contain code and resources, or in a satellite, the satellite will then contain just resources and the main assembly will contain just code.

Our recommendation is that the source language resources be stored in the main assembly.  This is the default setting in the development environment.  However, as well as ensuring that there is no <UICulture> entry in the csproj file, the following should be added in AssemblyInfo.cs, it explicitly states the location of the source language resources:

[assembly:NeutralResourcesLanguage("en-IE", UltimateResourceFallbackLocation.MainAssembly)]

 

String tables

If you are writing a purely XAML GUI application, we recommend you don't use a ResX string table to store UI strings. Leave them all in XAML declaration or alternatively  use a resource dictionary. A resource dictionary is a XAML construct; however it does not typically store any UI, just a list of strings with IDs, wrapped in some XAML mark-up.

Resource dictionaries can also store style information, themes and binary resources among other things. For simplicity, each type of resource can be factored into a different resource dictionary and these can be merged later if required.

The resource dictionary can be stored at application level and referenced throughout the WPF application.  There is a lot of built-in support for this mechanism and it's very flexible when setup correctly, more so than ResX files. Resource dictionaries should not be used to store visual templates as the contents of resource dictionaries cannot be visualized.

 

File Preparation

XAML (Extensible Application Markup Language; pronounced "zammel") is a declarative XML-based language that defines rich GUIs.  A typical WPF project will consist of a mixture of code files and XAML files.

Catalyst requires that all UI elements in XAML have a unique identifier (UId) and will alert the user in the Results window if they do not appear to be present.  UIds are used to keep track of changes to files and to identify items that must be translated.  It’s essential that they are present as Microsoft has not provided a mechanism to manually parse resources in assemblies, Catalyst is tied to their APIs and these in turn rely on UIds being present.  To add UIds to XAML files in a project, the MsBuild tool must be run on the project file:

Msbuild /t:updateuid [Project Name].csproj

Then, to check that there are no missing or duplicate UIds run:

Msbuild /t:checkuid [Project Name].csproj

The project should now be recompiled.

 

Related topics

 

Products or Versions Affected

  • Alchemy Catalyst 10.0  and greater

 

Last updated with Catalyst 11 Sp1