Search in sources :

Example 1 with ResourceBundleFilter

use of org.omegat.filters2.text.bundles.ResourceBundleFilter in project omegat by omegat-org.

the class ResourceBundleFilterTest method testNOI18N.

@Test
public void testNOI18N() throws Exception {
    String f = "test/data/filters/resourceBundle/file-ResourceBundleFilter-NOI18N.properties";
    ResourceBundleFilter filter = new ResourceBundleFilter();
    IProject.FileInfo fi = loadSourceFiles(filter, f);
    checkMultiStart(fi, f);
    checkMulti("Value", "ID", null, null, null, null);
    checkMultiEnd();
    translateText(filter, f);
}
Also used : ResourceBundleFilter(org.omegat.filters2.text.bundles.ResourceBundleFilter) IProject(org.omegat.core.data.IProject) Test(org.junit.Test)

Example 2 with ResourceBundleFilter

use of org.omegat.filters2.text.bundles.ResourceBundleFilter in project omegat by omegat-org.

the class ResourceBundleFilterTest method testAlign.

@Test
public void testAlign() throws Exception {
    final AlignResult ar = new AlignResult();
    align(new ResourceBundleFilter(), "resourceBundle/file-ResourceBundleFilter.properties", "resourceBundle/file-ResourceBundleFilter_be.properties", new IAlignCallback() {

        public void addTranslation(String id, String source, String translation, boolean isFuzzy, String path, IFilter filter) {
            ar.found = id.equals("ID") && source.equals("Value") && translation.equals("test");
        }
    });
    assertTrue(ar.found);
}
Also used : IFilter(org.omegat.filters2.IFilter) ResourceBundleFilter(org.omegat.filters2.text.bundles.ResourceBundleFilter) IAlignCallback(org.omegat.filters2.IAlignCallback) Test(org.junit.Test)

Example 3 with ResourceBundleFilter

use of org.omegat.filters2.text.bundles.ResourceBundleFilter in project omegat by omegat-org.

the class ResourceBundleFilterTest method testCommentEscaping.

@Test
public void testCommentEscaping() throws Exception {
    String f = "test/data/filters/resourceBundle/file-ResourceBundleFilter-Comments.properties";
    ResourceBundleFilter filter = new ResourceBundleFilter();
    IProject.FileInfo fi = loadSourceFiles(filter, f);
    checkMultiStart(fi, f);
    checkMulti("Value", "ID", null, null, null, "# Foo\\");
    checkMultiEnd();
    translateText(filter, f);
}
Also used : ResourceBundleFilter(org.omegat.filters2.text.bundles.ResourceBundleFilter) IProject(org.omegat.core.data.IProject) Test(org.junit.Test)

Example 4 with ResourceBundleFilter

use of org.omegat.filters2.text.bundles.ResourceBundleFilter in project omegat by omegat-org.

the class TmxComplianceTests method testExport1C.

/**
 * Test Export1C - Java Properties
 */
@Test
public void testExport1C() throws Exception {
    File tmxFile = new File("test/data/tmx/TMXComplianceKit/ExportTest1C.tmx");
    File sourceFile = new File("test/data/tmx/TMXComplianceKit/ExportTest1C.properties");
    File translatedFile = new File("test/data/tmx/TMXComplianceKit/ExportTest1C_fr.properties");
    ProjectProperties props = new TestProjectProperties("EN-US", "FR-CA");
    align(new ResourceBundleFilter(), sourceFile, null, translatedFile, null, props);
    compareTMX(tmxFile, outFile, 6);
}
Also used : ResourceBundleFilter(org.omegat.filters2.text.bundles.ResourceBundleFilter) File(java.io.File) Test(org.junit.Test)

Example 5 with ResourceBundleFilter

use of org.omegat.filters2.text.bundles.ResourceBundleFilter in project omegat by omegat-org.

the class ResourceBundleFilterTest method testDoNotEscapeUnicodeLiterals.

@Test
public void testDoNotEscapeUnicodeLiterals() throws Exception {
    String f = "test/data/filters/resourceBundle/file-ResourceBundleFilter-UnicodeLiterals.properties";
    ResourceBundleFilter filter = new ResourceBundleFilter();
    Map<String, String> options = new HashMap<String, String>();
    options.put(ResourceBundleFilter.OPTION_DONT_UNESCAPE_U_LITERALS, "true");
    IProject.FileInfo fi = loadSourceFiles(filter, f, options);
    checkMultiStart(fi, f);
    checkMulti("a\nb\\u0020\\ad", "MU", null, null, null, "# \\u00ad");
    checkMultiEnd();
    translateText(filter, f, options);
}
Also used : HashMap(java.util.HashMap) ResourceBundleFilter(org.omegat.filters2.text.bundles.ResourceBundleFilter) IProject(org.omegat.core.data.IProject) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 ResourceBundleFilter (org.omegat.filters2.text.bundles.ResourceBundleFilter)8 IProject (org.omegat.core.data.IProject)5 File (java.io.File)2 HashMap (java.util.HashMap)1 IAlignCallback (org.omegat.filters2.IAlignCallback)1 IFilter (org.omegat.filters2.IFilter)1 TranslationException (org.omegat.filters2.TranslationException)1