Multilingual Support

  • 1.4K Views
  • Last Post 17 February 2017
DerekMaciak posted this 17 February 2017

Accelerator has full support for multiple cultures and well defined best practices that are included in the runtime core components, helper classes, wrappers and development tools including the code generation engine.

What we did for you in the Accelerator:

There are 3 different areas that needed to be translated within the Accelerator Product itself. These areas include the:

  • Accelerator Core Description and Message Resourse Files (.resx)
  • Accelerator Maintenance Description and Message Resourse Files (.resx)
  • Accelerator Database MetaData Names and Descriptions

The Accelerator has language packs for several languages which were translated using Google translate and meant for demonstration purposes only. The following languages are Spanish (Spain), French (France), Japanese (Japan), Portuguese (Brazil) and Chinese (Simplified). The Description and Message resources for all these languages is included with the Accelerator Install for both the Accelerator Core and the Accelerator Maintenance.  The Language packs for the Accelerator Database Metadata needs to be downloaded and run separately.  You can download the SQL script here. All you need to do is unzip and change the "USE" statement at the top and run the script. This will insert data into the AC_MultilingualExt file in your Accelerator Database. Please contact us if you want to use a language in production or need to support additional languages. We will be happy to assist.

Your generated system has 2 different areas that need to be translated. These areas include the:

  • BOS System Shared Message and Description Resources (.resx)
  • Accelerator Database MetaData Names and Descriptions 

Here is what you need to do to support a new Language:

1) Add a Message Resource and a Description Resource for each language to the BOS System Shared Project and within the Properties folder. You will notice that you already have a MessageResource.resx and a DescriptionResource.resx. That was created when you initially generated the system and contains your default culture text. You can download the following sample resources and add them to the Properties folder. Just make sure to include them in your project. Or you can create the additional resourses (.resx) in Visual Studio. When you add the new Message Resource and Description Resource, you need to add the Culture Name for the language you want to support using this format: MessageResource.<CultureName>.resx and DescriptionResource.<CultureName>.resx. Refer to this link for a list of cultures. Here is an example with several resources added.

2) Translate the Message Resource and the Description Resource. There are several different resx managers out there. I recommend Zeta Resource Editor. All of them allow you to do side by side translation. I like Zeta Resource Editor because you can create Projects that contain a collection of resources and it has the ability to auto translate via Bing or Google Translate. You will need to open all your description resources as a group and translate them and then open all your message resources as a group and translate them.  When you open them as a group, you will see that the manager puts your default resource first (That is the .resx without the Culture Name) and then the others follow it. Go ahead and translate and then save it when you are done. Remember you can use Bing or Google Translate.

3) Translate your System MetaData Names and Descriptions that are in the Accelerator Database. You can do this by running the Framework Data Multilingual Translation Tool located within the Tools menu of the Accelerator LuanchPad.

This will open the following window that allows you to 1) Select a table to translate, 2) Select a Language that you want to translate to, 3) Translate by clicking the "Auto Translate Missing" Button or by manually translating the Name and Description in the Grid and 4) Save the Translation.  You will need to do this for each Table that is in the drop down from step 1 and for each culture you want to translate to in step 2.

Order By: Standard | Newest | Votes
DerekMaciak posted this 17 February 2017

4) Enroll the languages into the login for each UX you want to support.

  • For WPF, Open the Logon.xaml.cs that is in your WPF System Project. In the logon constructor, enroll all your cultures.
public Logon()
{
    InitializeComponent();

    am_EnrollCulture(new List<System.Globalization.CultureInfo>() {
                new System.Globalization.CultureInfo("en-US"),
                new System.Globalization.CultureInfo("es-ES"),
                new System.Globalization.CultureInfo("fr-FR"),
                new System.Globalization.CultureInfo("ja-JP"),
                new System.Globalization.CultureInfo("pt-BR"),
                new System.Globalization.CultureInfo("zh-CN"),
            });

    ap_LanguageComboBoxVisibility = Visibility.Visible;
}

When you run the WPF System, if you set the ap_LanguageComboBoxVisibility to Visible you can click on the options button and it will look like this:

When you select a language, the logon will auto start with the newly selected language. In this example I selected Japanese and clicked the connect button.

DerekMaciak posted this 17 February 2017

  • For MVC, Open the AccountController.cs that is in your MVC System Project. In the Login Method determine if you will have multiple languages enrolled and if you want to give the user the option to choose by setting the IsLanguageDropdown visible to true.  Enroll all your cultures in the _EnrollCultures method.
// GET: /account/login
[AllowAnonymous]
[HttpGet]
public ActionResult Login(string returnUrl, string username, string culture)
{
    // We do not want to use any existing identity information
    EnsureLoggedOut();

    // Store the originating URL so we can attach it to a form field
    var accountLoginModel = new AB_LoginModel { ReturnUrl = returnUrl, UserName = username, DefaultCulture = string.IsNullOrWhiteSpace(culture) ? null : new System.Globalization.CultureInfo(culture) };

    _EnrollCultures(accountLoginModel);

    // Set Culture
    am_SetCulture(accountLoginModel.DefaultCulture);

    // Show Language Dropdown
    accountLoginModel.IsLanguageDropdownVisible = true;

    return View(accountLoginModel);
}

private static void _EnrollCultures(AB_LoginModel accountLoginModel)
{
    accountLoginModel.EnrolledCultures.AddRange(new List<System.Globalization.CultureInfo>() {
                new System.Globalization.CultureInfo("en-US"),
                new System.Globalization.CultureInfo("es-ES"),
                new System.Globalization.CultureInfo("fr-FR"),
                new System.Globalization.CultureInfo("ja-JP"),
                new System.Globalization.CultureInfo("pt-BR"),
                new System.Globalization.CultureInfo("zh-CN"),
            });
}

When you run the MVC System, if you set the IsLanguageDropdown to True it will look like this:

When you select a language, the logon will auto refresh with the newly selected language. In this example I selected Japanese and clicked the Sign In button.

Close