Ejemplo n.º 1
0
        public static string FromCultureInfo(this IPBELocalizedString str, CultureInfo cultureInfo)
        {
            if (cultureInfo is null)
            {
                throw new ArgumentNullException(nameof(cultureInfo));
            }
            string id = cultureInfo.TwoLetterISOLanguageName;

            switch (id)
            {
            case "en": return(str.English);

            case "fr": return(str.French);

            case "de": return(str.German);

            case "it": return(str.Italian);

            case "ja": return(str.Japanese_Kana);

            case "ko": return(str.Korean);

            case "es": return(str.Spanish);

            default: throw new ArgumentOutOfRangeException(nameof(cultureInfo));
            }
        }
Ejemplo n.º 2
0
            public PBEAlphabeticalListEntry(T key, object parameter)
            {
                switch (key)
                {
                case PBEAbility ability: Value = PBEDataProvider.Instance.GetAbilityName(ability); break;

                case PBEForm form: Value = PBEDataProvider.Instance.GetFormName((PBESpecies)parameter, form); break;

                case PBEGender gender: Value = PBEDataProvider.Instance.GetGenderName(gender); break;

                case PBEItem item: Value = PBEDataProvider.Instance.GetItemName(item); break;

                case PBEMove move: Value = PBEDataProvider.Instance.GetMoveName(move); break;

                case PBENature nature: Value = PBEDataProvider.Instance.GetNatureName(nature); break;

                case PBESpecies species: Value = PBEDataProvider.Instance.GetSpeciesName(species); break;

                case PBEStat stat: Value = PBEDataProvider.Instance.GetStatName(stat); break;

                case PBEType type: Value = PBEDataProvider.Instance.GetTypeName(type); break;

                default: throw new ArgumentOutOfRangeException(nameof(key));
                }
                Key = key;
            }
Ejemplo n.º 3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is null)
            {
                return(AvaloniaProperty.UnsetValue);
            }
            IPBELocalizedString localized = null;

            switch (value)
            {
            case PBEAbility ability: localized = PBEDataProvider.Instance.GetAbilityName(ability); break;

            case PBEGender gender: localized = PBEDataProvider.Instance.GetGenderName(gender); break;

            case PBEItem item: localized = PBEDataProvider.Instance.GetItemName(item); break;

            case IPBELocalizedString l: localized = l; break;

            case PBEMove move: localized = PBEDataProvider.Instance.GetMoveName(move); break;

            case PBENature nature: localized = PBEDataProvider.Instance.GetNatureName(nature); break;

            case PBESpecies species: localized = PBEDataProvider.Instance.GetSpeciesName(species); break;

            case PBEStat stat: localized = PBEDataProvider.Instance.GetStatName(stat); break;

            case PBEType type: localized = PBEDataProvider.Instance.GetTypeName(type); break;
            }
            return(StringRenderer.Render(localized is null ? value.ToString() : localized.FromPBECultureInfo(), parameter?.ToString()) ?? AvaloniaProperty.UnsetValue);
        }
 private PBELocalizedString(IPBELocalizedString other)
 {
     English        = other.English;
     French         = other.French;
     German         = other.German;
     Italian        = other.Italian;
     Japanese_Kana  = other.Japanese_Kana;
     Japanese_Kanji = other.Japanese_Kanji;
     Korean         = other.Korean;
     Spanish        = other.Spanish;
 }
Ejemplo n.º 5
0
        public object Convert(IList <object> values, Type targetType, object parameter, CultureInfo culture)
        {
            var species = (PBESpecies)values[0];

            if (!PBEDataUtils.HasForms(species, true))
            {
                return(AvaloniaProperty.UnsetValue);
            }
            PBEForm             form      = true ? 0 : (PBEForm)values[1]; // TODO
            IPBELocalizedString localized = PBEDataProvider.Instance.GetFormName(species, form);

            return(StringRenderer.Render(localized.FromPBECultureInfo(), parameter?.ToString()));
        }
Ejemplo n.º 6
0
 public static string FromPBECultureInfo(this IPBELocalizedString str)
 {
     return(str.FromCultureInfo(PBEDataProvider.PBECulture));
 }