Exemplo n.º 1
0
 internal virtual Dictionary <string, IEnumerable <string> > GetSettingsStrings()
 {
     return(new Dictionary <string, IEnumerable <string> >
     {
         { nameof(TextKeysBlacklist), TextKeysBlacklist },
         { nameof(CalcKeys), CalcKeys },
         { nameof(FormatKeys), FormatKeys },
         { nameof(SupportedCommands), SupportedCommands.Select(c => c.ToString()) },
         { nameof(SpecializedKeyCommands), SpecializedKeyCommands.Select(c => c.ToString()) },
         { nameof(GetRandomNameDirs), GetRandomNameDirs().ToList() },
         { nameof(GetScenarioDirs), GetScenarioDirs().ToList() }
     });
 }
Exemplo n.º 2
0
        protected KKS_TextResourceHelper()
        {
            SupportedCommands.Add(Command.Choice);

            foreach (var selectionCommand in SelectionCommands)
            {
                SupportedCommands.Add(selectionCommand);
                SpecializedKeyCommands.Add(selectionCommand);
            }

            // TextDump sometimes picks up this column header, so workaround here.
            TextKeysBlacklist.Add("表示名");
            TextKeysBlacklist.Add("名称");
            TextKeysBlacklist.Add("タイトル");
            TextKeysBlacklist.Add("Name");
        }
Exemplo n.º 3
0
        // Certain commands encode multiple pieces of data into their strings
        // we only want to expose the part that should be translated
        // use prefixing to signal to resource replacement when this is needed
        public virtual string GetSpecializedKey(ScenarioData.Param param, int i, out string toTranslate)
        {
            var key = toTranslate = param.Args[i];

            if (key.IsNullOrEmpty() || !SpecializedKeyCommands.Contains(param.Command))
            {
                return(key);
            }

            if (param.Command == Command.Choice)
            {
                if (!key.Contains(ChoiceDelimiter))
                {
                    // only choices that contain delimiters need translation
                    return(string.Empty);
                }

                toTranslate = key.Split(ChoiceDelimiter.ToCharArray())[0];
            }
            return(BuildSpecializedKey(param, toTranslate));
        }