Search code examples
c#mvvmprismenterprise

Localization in enterprise application


where would you place "localization & globalization" in an enterprise application 3-layered builded in c# WPF with MVVM and Prism? I mean in an application built like the pattern describe in msdn (http://msdn.microsoft.com/en-us/library/ee658124.aspx) in which layer would you put the logic for localization? what kind of approach would you use (resx files, db...)?


Solution

  • Resx files

    but this is NOT a trivial subject and there isn't any one standard approach, with the major ones being:

    1. using WPF Resources
    2. using wpf's Locbaml tooling
    3. using RESX files as xaml static strings
    4. using RESX files with an extension

    Recommended references: Sacha Barber, Josh Smith, and ResX.

    My preference is to use a combination of (3) and (4), although I needed to modify the code for the extension a bit. So I will typically have

    1. A project (MyApp.Presentation.Resources) of Resx file(s), one per view
    2. A project (MyApp.Domain.Resources) of Resx file(s), one per enum type, standard commands
    3. A project of view models (MyApp.ViewModels) which references MyApp.Domain.Resources enums as needed
    4. A project of controls and/views) (MyApp.Wpf.ControlLib) which references MyApp.Presentation.Resources and my version of a ResxExtension.dll.

    HTH,
    Berryl