コード例 #1
0
 public static void RegisterDictionary(CultureInfo cultureInfo, BaseLanguagePack dictionary)
 {
     if (!LocalizationService.RegisteredPacks.ContainsKey(cultureInfo))
     {
         LocalizationService.RegisteredPacks.Add(cultureInfo, dictionary);
     }
 }
コード例 #2
0
        static BaseLanguagePack ResolveDictionary()
        {
            var dictionary = BaseLanguagePack.GetResources(LocalizationService.Current.Culture);

            if (dictionary == null)
            {
                throw new InvalidOperationException(
                          $"Pack for language {LocalizationService.Current.Culture} was not found");
            }

            return(dictionary);
        }
コード例 #3
0
        public static BaseLanguagePack GetResources(CultureInfo cultureInfo)
        {
            if (cultureInfo == null)
            {
                throw new ArgumentNullException(nameof(cultureInfo));
            }

            if (!LocalizationService.RegisteredPacks.ContainsKey(cultureInfo))
            {
                return(Null);
            }

            BaseLanguagePack dictionary = LocalizationService.RegisteredPacks[cultureInfo];

            return(dictionary);
        }