Click here to Skip to main content
15,881,812 members
Articles / Desktop Programming / WPF

Localization Sync

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
23 Feb 2012CPOL4 min read 21.3K   625   9  
Small utility to keep localized resources synchronized
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace LocalizationSync
{
    public class Info : INotifyPropertyChanged
    {
        private string content;
        private InfoType kind = InfoType.Undefined;
        public event PropertyChangedEventHandler PropertyChanged;

        public Info(string message, InfoType messageKind)
        {
            Content = message;
            Kind = messageKind;
            switch (messageKind)
            {
                case InfoType.Error:
                    Log.Error(message);
                    break;
                case InfoType.Info:
                case InfoType.Warning:
                    Log.Info(message);
                    break;
            }
        }

        public string Content
        {
            get { return content; }
            set
            {
                if (value != this.content)
                {
                    this.content = value;
                    NotifyPropertyChanged("Content");
                }
            }
        }

        public InfoType Kind
        {
            get { return kind; }
            set
            {
                if (value != this.kind)
                {
                    this.kind = value;
                    NotifyPropertyChanged("Kind");
                }
            }
        }

        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Romania Romania
I have been a software developer for a while and still find this an interesting job.

Comments and Discussions