Base solution for your next web application
BLACK FRIDAY
From Nov 21
To Dec 1
XXDAYS : XXHRS : XXMIN : XXSEC
SAVE UP TO$3K
Also valid for the
existing customers!
Open Closed

LocalizationDictionary not found anymore when updating ABP #538


0
hans abelshausen created

Hi, I have updated abp to newest version and now my dictionary provider is not working anymore... The function GetDictionaries is not there anymore and LocalizationDictionaryInfo has less params...Could you please show me the correct code?

public IEnumerable<LocalizationDictionaryInfo> GetDictionaries(string sourceName)
        {

            var cultures = _cultureService.GetOnlyLanguages().GlobalLanguages.ToList();
            var entries = _labelTextService.GetTranslationTexts().TranslationTexts.ToList();

            var dictionaries = new List<LocalizationDictionaryInfo>();

            foreach (var culture in cultures)
            {
                var tempInfo = new CultureInfo(culture.IsoCode);
                dictionaries.Add(new LocalizationDictionaryInfo(DbLocalizationDictionary.Build(tempInfo, entries),
                    isDefault: Convert.ToBoolean(culture.DefaultLang)));
            }
            return dictionaries;

        }

I have tried following code and the dictionaries are loaded. But if I change language in my menu, the localization do not swtich to the selected lang? [code][/public void Initialize(string sourceName) { var cultures = _cultureService.GetOnlyLanguages().GlobalLanguages.ToList(); var entries = _labelTextService.GetTranslationTexts().TranslationTexts.ToList();

        foreach (var culture in cultures)
        {
            var tempInfo = new CultureInfo(culture.IsoCode);
            if(Dictionaries == null)
                Dictionaries = new Dictionary&lt;string, ILocalizationDictionary&gt;();
            Dictionaries.Add(tempInfo.ToString(),DbLocalizationDictionary.Build(tempInfo, entries));
        }
    }code]

4 Answer(s)
  • 0
    hikalkan created
    Support Team

    Hi,

    Do you have a custom localization source which implements ILocalizationDictionaryProvider?

    If so, GetDictionaries changed to Dictionaries property (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp/Localization/Dictionaries/ILocalizationDictionaryProvider.cs">https://github.com/aspnetboilerplate/as ... rovider.cs</a>).

  • 0
    hans abelshausen created

    Hi, I have implemented a custom db localizationsource which was described here a few month ago. I'm using your Language Menu on top of the page! The currentlanguagemenu object is changing but abp.localization.values is not changing values to my selected language anymore. I think everything is correctly filled. Here is my code of my own dictionary provider:

    public IDictionary<string, ILocalizationDictionary> Dictionaries { get; set; }
            public void Initialize(string sourceName)
            {
                var cultures = _cultureService.GetOnlyLanguages().GlobalLanguages.ToList();
                var entries = _labelTextService.GetTranslationTexts().TranslationTexts.ToList();
                
                foreach (var culture in cultures)
                {
                    var tempInfo = new CultureInfo(culture.IsoCode);
                    if(Dictionaries == null)
                        Dictionaries = new Dictionary<string, ILocalizationDictionary>();
                    Dictionaries.Add(tempInfo.ToString(),DbLocalizationDictionary.Build(tempInfo, entries));
                }
            }
    
  • 0
    hans abelshausen created

    Seems to me, that <a href="~/AbpLocalization/ChangeCulture?cultureName={{language.name}}&returnUrl=@ApplicationPath">{{language.name}}</a> is not working anymore... Have you changed something?

    Thanks in advance

  • 0
    hikalkan created
    Support Team

    No, ~/AbpLocalization/ChangeCulture... should work as before. Are you getting an error?