GetCulture() 정적인 개인적인 메소드

Gets a culture specific for the given category.
static private GetCulture ( Context ctx, Category category ) : CultureInfo
ctx Pchp.Core.Context Current runtime context.
category Category The category.
리턴 System.Globalization.CultureInfo
예제 #1
0
        public static string?bindtextdomain(Context ctx, string domain, string directory)
        {
            string localeDir = FileSystemUtils.AbsolutePath(ctx, directory);

            var culture = Locale.GetCulture(ctx, Locale.Category.All);

            var catalog = GetOrLoadCatalog(new CacheKey()
            {
                LocaleDir = localeDir, Culture = culture, Domain = domain
            });

            var translationCtx = ctx.GetStatic <TranslationContext>();

            translationCtx.BindTextDomain(domain, localeDir);

            return(catalog.IsValid ? localeDir : null);
        }
예제 #2
0
        private static FlaggedCatalog?TryGetCatalog(Context ctx, string?domainOverride = null)
        {
            var    translationCtx = ctx.GetStatic <TranslationContext>();
            string domain         = domainOverride ?? translationCtx.Domain;
            string?localeDir      = translationCtx.GetLocaleDir(domain);

            if (localeDir == null)
            {
                return(null);
            }

            var culture  = Locale.GetCulture(ctx, Locale.Category.All);
            var cacheKey = new CacheKey()
            {
                LocaleDir = localeDir, Culture = culture, Domain = domain
            };

            return(GetOrLoadCatalog(cacheKey));
        }