public LanguageWorker_Russian() { _caseMap = LanguageWorkerUtil.ReadAndBuildCaseMap(); _pluralMap = LanguageWorkerUtil.ReadAndBuildPluralMap(); _resolver.RegisterMethod("Case", new CaseMethod(_caseMap)); _resolver.RegisterMethod("Replace", new ReplaceMethod()); _resolver.RegisterMethod("Number", new NumberCaseMethod()); }
/// <summary> /// Read CaseMap from WordInfo files /// </summary> /// <returns></returns> public static CaseMap ReadAndBuildCaseMap() { LoadedLanguage language = LanguageDatabase.activeLanguage; CaseMap caseMap = new CaseMap(); foreach (Tuple <VirtualDirectory, ModContentPack, string> localDirectory in language.AllDirectories) { VirtualDirectory wordInfoDir = localDirectory.Item1.GetDirectory(WordInfoDirName); if (LanguageWorkerUtil.TryLoadLinesFromFile(wordInfoDir.GetFile(CaseFileName), localDirectory, language, out IEnumerable <string> casedLines)) { foreach (string casedline in casedLines) { if (LanguageWorkerUtil.TryGetSemicolonSeparatedValues(casedline, out string[] casedForms))