/// <summary> /// 2013C: Ovo je bitno da bude pozvano kako bi uspesno referencirao ovu Biblioteku!! -- > TREBA DA GA POZOVE manager.onApplicationReady() /// </summary> public static void Prepare() { aceLog.consoleControl.setAsOutput(log, "lang_mng"); //basicLanguageCollection.isReadyGlobal = true; // Int32 ln = languages.loadItems(false, 5); // log.log("Hunspell language definitions loaded [" + ln + "]"); if (_serbian == null) { _serbian = new extendedLanguage(); // _serbian.morphologies_verbs.buildDefaultItem(); // _serbian.morphologies_nouns.buildDefaultItem(); if (!File.Exists(PATH_hunspell_aff)) { throw new aceGeneralException("Hunspell AFF file missing!"); } if (!File.Exists(PATH_hunspell_dict)) { throw new aceGeneralException("Hunspell DICT file missing!"); } basicLanguage language = new basicLanguage(); language.affixFilePath = PATH_hunspell_aff; language.dictFilePath = PATH_hunspell_dict; language.languageNativeName = "Srpski"; language.languageEnglishName = "Serbian"; language.iso2Code = "sr"; _serbian.basic = language; if (language.checkHuspell(true)) { log.log("Hunspell language module: " + language.languageEnglishName + " ready"); } else { aceGeneralException axe = new aceGeneralException("Serbian language Hunspell module failed", null, english, "Serbian Hunspell failed"); throw axe; } _serbian.basic = language; _serbian.loadAlfabet("extended\\alfabet.txt"); } if (_english == null) { _english = new extendedLanguage { basic = new basicLanguage("en") }; _english.basic.affixFilePath = PATH_hunspell_aff_en; _english.basic.dictFilePath = PATH_hunspell_dict_en; _english.basic.languageNativeName = "Engleski"; _english.basic.languageEnglishName = "English"; _english.basic.iso2Code = "en"; if (_english.basic.checkHuspell(true)) { log.log("Hunspell language module: " + _english.basic.languageEnglishName + " ready"); } else { aceGeneralException axe = new aceGeneralException("English language Hunspell module failed", null, english, "English Hunspell failed"); throw axe; } } //languages.loadItems(false, -1, 0, System.Data.LoadOption.OverwriteChanges); //dictionaryManager.prepare(); //elementsManager.prepare(); languageManagerApertium.manager.prepare(); languageManagerAlphabet.manager.prepare(); // languageManagerDictionary.manager.prepare(); // languageManagerElements.manager.prepare(); languageManagerHunspell.manager.prepare(); // languageManagerLexicon.manager.prepare(); // languageManagerMorphology.manager.prepare(); languageManagerUnitex.manager.prepare(); languageManagerWordnet.manager.prepare(); // languageManagerDict.manager.prepare(); languageManagerDBNamedEntities.manager.prepare(); semanticLexicon.semanticLexiconManager.manager.prepare(); if (serbian.basic.hunspellEngine.Spell("Proba")) { log.log("Hunspell language module: " + serbian.basic.languageEnglishName + " Spell check working"); } if (english.basic.hunspellEngine.Spell("Test")) { log.log("Hunspell language module: " + english.basic.languageEnglishName + " Spell check working"); } aceLog.consoleControl.removeFromOutput(log); }
/// <summary> /// staticka kolekcija basicLanguage objekata /// </summary> // public static basicLanguageCollection languages; public static basicLanguage getLanguage(string iso2code) { if (serbian == null) { serbian = new extendedLanguage(); if (!File.Exists(PATH_hunspell_aff)) { throw new aceGeneralException("Hunspell AFF file missing!"); } if (!File.Exists(PATH_hunspell_dict)) { throw new aceGeneralException("Hunspell DICT file missing!"); } basicLanguage language = new basicLanguage(); language.affixFilePath = PATH_hunspell_aff; language.dictFilePath = PATH_hunspell_dict; language.languageNativeName = "Srpski"; language.languageEnglishName = "Serbian"; language.iso2Code = "sr"; serbian.basic = language; if (language.checkHuspell(true)) { } else { } } return(serbian.basic); //// < ---- override //String query = "iso2Code='{0}'".FormatWith(iso2code); //basicLanguage language = new basicLanguage(); //try //{ // Int32 i = languages.loadItems(true, 10, 0, System.Data.LoadOption.OverwriteChanges); // var lang = languages.selectItems<basicLanguage>(query, 1).First(); // if (i > 0) // { // // // languages.instances.FirstOrDefault(x => x.iso2Code == iso2code); // if (lang != null) // { // return lang; // } else // { // return serbian.basic; // } // } else // { // return serbian.basic; // } // //.selectItems<basicLanguage>(query, 1).First<basicLanguage>(); //} catch (Exception ex) //{ // if (getLanguageFailed) throw new aceGeneralException("Language selection failed second time", ex, serbian, "Language database never loaded"); // getLanguageFailed = true; // log.log("Language database not ready --> loading Serbian as default."); // return serbian.basic; //} //// imbLanguageFramework.imbLanguageFrameworkManager.languages.selectItemByUnique(AgentSettings.languageIsoCode) as basicLanguage; //if (language == null) //{ // String msg = "Basic language definition for [" + iso2code + // "] not found in the global languages collection (" + // imbLanguageFramework.imbLanguageFrameworkManager.languages.Count + ")"; // logSystem.log(msg, logType.FatalError, true); // throw new aceGeneralException("Language init failed"); //} //return language; }