コード例 #1
0
        /// <summary>
        /// Retrieves available localizations by locating folders inside the localization resources root.
        /// Folder names should correspond to the <see cref="LanguageTags"/> tag entries (RFC5646).
        /// </summary>
        private async Task RetrieveAvailableLocalesAsync()
        {
            var resources = await providerList.LocateFoldersAsync(config.LoaderConfiguration.PathPrefix);

            AvailableLocales.Clear();
            AvailableLocales.AddRange(resources.Select(r => r.Name).Where(tag => LanguageTags.ContainsTag(tag)));
            AvailableLocales.Add(SourceLocale);
        }
コード例 #2
0
        static LocalesPopupDrawer()
        {
            values = LanguageTags.GetAllTags().ToArray();

            valuesWithEmpty = LanguageTags.GetAllTags().ToArray();
            ArrayUtils.Insert(ref valuesWithEmpty, 0, emptyOptionValue);

            var rfcRecords  = LanguageTags.GetAllRecords();
            var optionsList = new List <GUIContent>();

            foreach (var kv in rfcRecords)
            {
                var option = new GUIContent($"{kv.Value} ({kv.Key})");
                optionsList.Add(option);
            }

            options = optionsList.ToArray();
            optionsList.Insert(0, emptyOption);
            optionsWithEmpty = optionsList.ToArray();
        }