コード例 #1
0
        IEnumerable <LocalizedString> GetAllStrings(CultureInfo culture)
        {
            var dictionary = _localizationManager.GetDictionary(culture);

            foreach (var(key, value) in dictionary.Translations)
            {
                yield return(new LocalizedString(key, value.FirstOrDefault()));
            }
        }
コード例 #2
0
        public PortableObjectStringLocalizer(CultureInfo culture, string context, ILocalizationManager localizationManager, ILogger logger)
        {
            Context = context;
            _localizationManager = localizationManager;
            _logger     = logger;
            _dictionary = localizationManager.GetDictionary(culture);

            if (culture.Parent != null)
            {
                _parentCultureDictionary = localizationManager.GetDictionary(culture.Parent);
            }
        }
コード例 #3
0
        public DefaultModularLocalizer(CultureInfo culture, ILocalizationManager localizationManager,
                                       ITenantShellManager tenantShellManager, Type localizer)
        {
            _localizationManager = localizationManager;
            _tenantShellManager  = tenantShellManager;
            _localizer           = localizer;

            var feature = _tenantShellManager.GetCurrentTenantShellContext().Blueprint.Dependencies[localizer];

            _localizationDictionary = _localizationManager.GetDictionary(feature.FeatureInfo.Id, culture);
        }
コード例 #4
0
        public IEnumerable <LocalizedString> GetAllStrings(bool includeParentCultures)
        {
            var culture = CultureInfo.CurrentUICulture;

            while (culture != null)
            {
                var dictionary = _localizationManager.GetDictionary(culture);

                foreach (var entry in dictionary.Translations.Select(t => new LocalizedString(t.Key, t.Value.FirstOrDefault())))
                {
                    yield return(entry);
                }

                if (culture == culture.Parent)
                {
                    break;
                }

                culture = culture.Parent;
            }
        }