This project is read-only.

Multilingual support?

May 31, 2013 at 11:37 PM
Edited Jun 1, 2013 at 12:14 AM
Markus,

We are interested in making our app able to work in different languages, support local data masking (Canada zips vs US zips, state codes, etc.) and possibly some other capabilities.

Our thought is to have a table that corresponds to each field in each table. Each record in this table would have the table name, field name, label, code mask, and field type (not sure if we need it). We might also have fields for the appropriate label in a given language.

Then in my request object, I would simply specify the users language and all the labels and associated data would come back with the settings for that language along with the actual data fields.

Given all the discussions on the subject, I assume there is something in place to handle this, but wasn't sure where to look in the FW to find it.

Another reason for this approach is that we need to give the users the ability to override the label we use. For example, we may use the term Department but they may want to use Development Group. You get the idea.

One last benefit would be to allow an administrator to indicate that they do not want the field to show at all. For example, Race - sometimes it is allowed, other times not. And this can vary from area to area.

I am sure you know of many others, so I will leave it at that. You get the idea.

Thanks,

Fletcher
Jun 2, 2013 at 9:29 PM
The way I would do this in an MVVM type of app is expose all this through the view model. So for instance, if you have a special input mask need, you could expose a property on the view model for the input mask and then bind that into the appropriate property in the UI. And of course at that point, it would be easy to retrieve that view-model property setting from whatever system you use to define these things.

Example:
public class PriceViewModel : ViewModel
{
    private decimal _price;
    public decimal Price
    {
        get { return _price; }
        set
        {
            _price = value;
            NotifyChange("Price");
        }
    }

    private string _priceInputMask;
    public string PriceInputMask
    {
        get
        {
            if (string.IsNullOrEmpty(_priceInputMask))
            {
                _priceInputMask = Resources.PriceInputMask:
                NotifyChanged("PriceInputMask");
            }
            return _priceInputMask;
        }
    }
}
Markus
Jun 11, 2013 at 6:49 PM
Markus,

I am still a little confused. Retrieving the mask is easy. I am more concerned about how I would write the xaml so that the mask is applied. Say a zip code mask (Canada vs. US - where we have either a mask of DDDDD-DDDD or ADA DAD.

For the labels, I can probably just bind the label's Content to a property in the modelview that has the label in the appropriate language. And I should be able to set the language on a global scale so that the text appears using the right characters.

Thanks,

Fletcher
Jun 14, 2013 at 1:10 PM
Ah, right. At that point, it really becomes more of a regular WPF mechanics issue rather than multi-lingual or multi-cultural. By default, WPF does not support textbox input masks. We haven't done anything for that in CODE Framework at this point, but we have some other code somewhere for internal stuff. Maybe I'll take a peek to see how hard it would be to bring that over into the framework.


Markus