• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Language类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: genXliff

import org.omegat.util.Language; //导入依赖的package包/类
private String genXliff(Language sLang, Language tLang, String text) {
    ++transUnitId;
    if (settings.getBoolean("filter", false)) {
        text = text.replaceAll("<\\/?[a-z]\\d+>", "");
    }
    String xliff
            = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
            + "<xliff version=\"1.2\">\n"
            + "  <file source-language=\"" + sLang + "\" target-language=\"" + tLang + "\">\n"
            + "    <header>\n"
            + "      <note from=\"PTTOOLS\">\n"
            + "        <graphname>" + settings.get("engine", null) + "</graphname>\n"
            + "      </note>\n"
            + "    </header>\n"
            + "    <body>\n"
            + "      <trans-unit id=\"" + Long.toString(transUnitId) + "\">\n"
            + "        <source>" + StringEscapeUtils.escapeXml10(text) + "</source>\n"
            + "      </trans-unit>\n"
            + "    </body>\n"
            + "  </file>\n"
            + "</xliff>\n";
    return xliff;
}
 
开发者ID:omongo,项目名称:pt-omegat,代码行数:24,代码来源:PrecisionTranslation.java


示例2: testIsFileSupported_true

import org.omegat.util.Language; //导入依赖的package包/类
@Test
void testIsFileSupported_true() throws Exception {
    OmegatMarkdownFilter mdf = new OmegatMarkdownFilter();
    File target = new File(this.getClass().getResource("/source/case0.md").getFile());
    FilterContext fc = new FilterContext(new Language("en"), new Language("be"), true);
    assertTrue(mdf.isFileSupported(target, null, fc));
}
 
开发者ID:miurahr,项目名称:omegat-markdown-plugin,代码行数:8,代码来源:OmegatMarkdownFilterTest.java


示例3: testIsFileSupported_false

import org.omegat.util.Language; //导入依赖的package包/类
@Test
void testIsFileSupported_false() throws Exception {
    OmegatMarkdownFilter mdf = new OmegatMarkdownFilter();
    File target = new File(this.getClass().getResource("/source/nomarkdown.txt").getFile());
    FilterContext fc = new FilterContext(new Language("en"), new Language("be"), true);
    assertFalse(mdf.isFileSupported(target, null, fc));
}
 
开发者ID:miurahr,项目名称:omegat-markdown-plugin,代码行数:8,代码来源:OmegatMarkdownFilterTest.java


示例4: translate

import org.omegat.util.Language; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected String translate(Language sLang, Language tLang, String text) throws Exception {
    String xliff = genXliff(sLang, tLang, text);
    XmlRpcClient client = setUpClient();
    try {
        Object[] params = new Object[]{new Object[]{xliff}};
        Object[] runResults = (Object[]) client.execute("run", params);
        String jobId = (String) runResults[0];
        if (!jobId.equals("")) {
            params = new Object[]{new Object[]{jobId}, false, true, settings.getBoolean("delete", true)};
            Map<String, Map> statusResults;
            String status;
            do {
                statusResults = (Map<String, Map>) client.execute("status", params);
                status = (String) statusResults.get(jobId).get("status");
            } while (!status.equals("completed") && !status.equals("failed"));
            Object[] contents = (Object[]) statusResults.get(jobId).get("content");
            if (status.equals("completed") && contents.length != 0) {
                String transXliff = (String) contents[0];
                Pattern p = Pattern.compile("state=\"new\">(.*)</target>", Pattern.MULTILINE);
                Matcher m = p.matcher(transXliff);
                if (m.find()) {
                    String transUnit = StringEscapeUtils.unescapeXml(m.group(1));
                    return transUnit;
                }
            }
        } else {
            return "ERROR!\n" + "Missing graph or invalid configurations";
        }
    } catch (XmlRpcException ex) {
        Logger.getLogger(SettingsDialog.class.getName()).log(Level.SEVERE, null, ex);
        return "ERROR!\n" + ex.getMessage();
    }
    return xliff;
}
 
开发者ID:omongo,项目名称:pt-omegat,代码行数:37,代码来源:PrecisionTranslation.java


示例5: translate

import org.omegat.util.Language; //导入依赖的package包/类
@Override
protected String translate(Language sLang, Language tLang, String text) throws Exception {

    String server = System.getProperty("moses.server.url");
    
    if (server == null) {
        return "The Moses server address is not available.";
    }

    Map<String, String> mosesParams = new HashMap<String, String>();
    
    XmlRpcClient client = new XmlRpcClient();
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    
    config.setServerURL(new URL(server));
    client.setConfig(config);
    
    mosesParams.put("text", mosesPreprocess(text, sLang.getLocale()));
    
    Object[] xmlRpcParams = new Object[] { mosesParams };

    String result;  
    try {
        HashMap<?, ?> response = (HashMap<?, ?>) client.execute("translate", xmlRpcParams);
        result = (String) response.get("text");
 } catch (XmlRpcException e) {
        return e.getLocalizedMessage();
    }
    return mosesPostprocess(result, tLang);
}
 
开发者ID:amake,项目名称:omegat-moses-mt,代码行数:31,代码来源:MosesTranslate.java


示例6: mosesPostprocess

import org.omegat.util.Language; //导入依赖的package包/类
private String mosesPostprocess(String text, Language targetLanguage) {
    String result = CharacterReference.decode(text);
    
    result = DeNormalize.processSingleLine(result).replaceAll("\\s+", " ").trim();

    if (!targetLanguage.isSpaceDelimited()) {
        result = result.replaceAll("(?<=[\u3001-\u9fa0])\\s+(?=[\u3001-\u9fa0])", "");
    }

    return cleanSpacesAroundTags(result, text);
}
 
开发者ID:amake,项目名称:omegat-moses-mt,代码行数:12,代码来源:MosesTranslate.java


示例7: translate

import org.omegat.util.Language; //导入依赖的package包/类
@Override
protected String translate(Language sLang, Language tLang, String text) throws Exception {
	return LocalApertiumTranslate.translateApertiumLocalInstallation(text);
}
 
开发者ID:transducens,项目名称:apertium-cli-omegat,代码行数:5,代码来源:ApertiumConsoleTranslate.java


示例8: massTranslate

import org.omegat.util.Language; //导入依赖的package包/类
public List<String> massTranslate(Language sLang, Language tLang, List<String> texts) throws Exception {
	return LocalApertiumTranslate.translateApertiumLocalInstallation(texts);
}
 
开发者ID:transducens,项目名称:apertium-cli-omegat,代码行数:4,代码来源:ApertiumConsoleTranslate.java


示例9: getSourceLanguage

import org.omegat.util.Language; //导入依赖的package包/类
public Language getSourceLanguage() {
    return new Language("en");
}
 
开发者ID:mespla,项目名称:OmegaT-SessionLog,代码行数:4,代码来源:ProjectProperties.java


示例10: getTargetLanguage

import org.omegat.util.Language; //导入依赖的package包/类
public Language getTargetLanguage() {
    return new Language("pl");
}
 
开发者ID:mespla,项目名称:OmegaT-SessionLog,代码行数:4,代码来源:ProjectProperties.java


示例11: translate

import org.omegat.util.Language; //导入依赖的package包/类
public String translate(Language sLang, Language tLang, String text)
throws Exception {return "";}
 
开发者ID:mespla,项目名称:OmegaT-SessionLog,代码行数:3,代码来源:Google2Translate.java


示例12: getTranslation

import org.omegat.util.Language; //导入依赖的package包/类
public String getTranslation(Language sLang, Language tLang, String text)
throws Exception {return "";}
 
开发者ID:mespla,项目名称:OmegaT-SessionLog,代码行数:3,代码来源:BaseTranslate.java


示例13: getTranslation

import org.omegat.util.Language; //导入依赖的package包/类
/**
 * Translate.
 * 
 * @param sLang
 *            source language
 * @param tLang
 *            target language
 * @param text
 *            text for translation
 * @return translated text, or null if translation impossible
 */
String getTranslation(Language sLang, Language tLang, String text) throws Exception;
 
开发者ID:mespla,项目名称:OmegaT-SessionLog,代码行数:13,代码来源:IMachineTranslation.java


示例14: getTranslation

import org.omegat.util.Language; //导入依赖的package包/类
String getTranslation(Language sLang, Language tLang, String text) throws Exception; 
开发者ID:transducens,项目名称:apertium-cli-omegat,代码行数:2,代码来源:IMachineTranslation.java


示例15: getTranslation

import org.omegat.util.Language; //导入依赖的package包/类
public String getTranslation(Language sLang, Language tLang, String text) {return null;} 
开发者ID:transducens,项目名称:apertium-cli-omegat,代码行数:2,代码来源:BaseTranslate.java


示例16: translate

import org.omegat.util.Language; //导入依赖的package包/类
abstract protected String translate(Language sLang, Language tLang, String text) throws Exception; 
开发者ID:transducens,项目名称:apertium-cli-omegat,代码行数:2,代码来源:BaseTranslate.java


示例17: translate

import org.omegat.util.Language; //导入依赖的package包/类
protected abstract String translate(Language sLang, Language tLang, String text) throws Exception; 
开发者ID:omongo,项目名称:pt-omegat,代码行数:2,代码来源:BaseTranslate.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JobLoadProgressDialog类代码示例发布时间:2022-05-22
下一篇:
Java CostMatrix类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap