当前位置: 首页>>代码示例>>Java>>正文


Java Language.getLanguageForShortName方法代码示例

本文整理汇总了Java中org.languagetool.Language.getLanguageForShortName方法的典型用法代码示例。如果您正苦于以下问题:Java Language.getLanguageForShortName方法的具体用法?Java Language.getLanguageForShortName怎么用?Java Language.getLanguageForShortName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.languagetool.Language的用法示例。


在下文中一共展示了Language.getLanguageForShortName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentLanguage

import org.languagetool.Language; //导入方法依赖的package包/类
private Language getCurrentLanguage() {
	if (autoDetectBox.isSelected()) {
		final LanguageIdentifier langIdentifier = new LanguageIdentifier(
				textArea.getText());
		Language lang = Language.getLanguageForShortName(langIdentifier
				.getLanguage());
		if (lang == null) {
			lang = Language.ENGLISH;
		}
		for (int i = 0; i < languageBox.getItemCount(); i++) {
			final I18nLanguage boxLanguage = (I18nLanguage) languageBox
					.getItemAt(i);
			if (boxLanguage.toString().equals(
					lang.getTranslatedName(messages))) {
				languageBox.setSelectedIndex(i);
			}
		}
		return lang;
	} else {
		return ((I18nLanguage) languageBox.getSelectedItem()).getLanguage();
	}
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:23,代码来源:LangToolMain.java

示例2: loadConfiguration

import org.languagetool.Language; //导入方法依赖的package包/类
private void loadConfiguration() throws IOException {
try (FileInputStream fis = new FileInputStream(configFile)) {
    final Properties props = new Properties();
    props.load(fis);

    disabledRuleIds.addAll(getListFromProperties(props, DISABLED_RULES_CONFIG_KEY));
    enabledRuleIds.addAll(getListFromProperties(props, ENABLED_RULES_CONFIG_KEY));
    disabledCategoryNames.addAll(getListFromProperties(props, DISABLED_CATEGORIES_CONFIG_KEY));

    final String motherTongueStr = (String) props.get(MOTHER_TONGUE_CONFIG_KEY);
    if (motherTongueStr != null) {
	motherTongue = Language.getLanguageForShortName(motherTongueStr);
    }

    final String autoDetectStr = (String) props.get(AUTO_DETECT_CONFIG_KEY);
    if (autoDetectStr != null) {
	autoDetect = autoDetectStr.equals("true");
    }

    final String runServerString = (String) props.get(SERVER_RUN_CONFIG_KEY);
    if (runServerString != null) {
	runServer = runServerString.equals("true");
    }
    final String serverPortString = (String) props.get(SERVER_PORT_CONFIG_KEY);
    if (serverPortString != null) {
	serverPort = Integer.parseInt(serverPortString);
    }
} catch (final FileNotFoundException e) {
    // file not found: okay, leave disabledRuleIds empty
}
   }
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:32,代码来源:Configuration.java


注:本文中的org.languagetool.Language.getLanguageForShortName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。