From 82ee09d26f415e165c9269bc94e4ba99a54e8fb2 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 6 Jul 2023 18:04:17 +0200 Subject: [PATCH] Revert "Release Preparation" This reverts commit e14baa3d412815ad964a321aa87549e59f8a6994. --- .gitattributes | 4 + .github/workflows/ci.yml | 44 + .gitignore | 40 + pom.xml | 112 ++ .../jason/translate/tasks/BingParseTask.java | 80 ++ .../jason/translate/tasks/DeeplParseTask.java | 80 ++ .../translate/tasks/IterateFilesetTask.java | 124 +++ .../translate/tasks/ReinsertDoctypeTask.java | 201 ++++ .../jason/translate/tasks/UrlEncodeTask.java | 78 ++ .../translate/tasks/WatsonParseTask.java | 80 ++ .../translate/tasks/YandexParseTask.java | 82 ++ .../resources/fox/jason/translate/antlib.xml | 986 ++++++++++++++++++ test/bing-response/build.xml | 25 + test/bing-response/expected.txt | 1 + test/bing-response/response.json | 7 + test/bing-response/result.txt | 1 + test/bootstrap.xml | 79 ++ test/create-xliff1-embedded/build.xml | 27 + test/create-xliff1-embedded/document.ditamap | 5 + test/create-xliff1-embedded/expected.xlf | 87 ++ test/create-xliff1-embedded/test.properties | 2 + test/create-xliff1-embedded/topic.dita | 81 ++ test/create-xliff1-glossentry/build.xml | 21 + .../create-xliff1-glossentry/document.ditamap | 10 + test/create-xliff1-glossentry/expected.xlf | 23 + test/create-xliff1-glossentry/glossary.dita | 7 + test/create-xliff1-glossentry/test.properties | 2 + test/create-xliff1-text/build.xml | 21 + test/create-xliff1-text/document.ditamap | 5 + test/create-xliff1-text/expected.xlf | 30 + test/create-xliff1-text/test.properties | 2 + test/create-xliff1-text/topic.dita | 19 + test/create-xliff1-translate-no/build.xml | 73 ++ .../document.ditamap | 8 + test/create-xliff1-translate-no/expected.xlf | 74 ++ .../notranslate-p.dita | 28 + .../notranslate-sub-topic.dita | 28 + .../notranslate.topic.dita | 28 + .../test.properties | 2 + test/create-xliff1-translate-no/topic.dita | 28 + test/create-xliff1-translate-yes/build.xml | 40 + .../document.ditamap | 5 + test/create-xliff1-translate-yes/expected.xlf | 28 + .../test.properties | 2 + test/create-xliff1-translate-yes/topic.dita | 15 + test/create-xliff2-embedded/build.xml | 39 + test/create-xliff2-embedded/document.ditamap | 5 + test/create-xliff2-embedded/expected.xlf | 217 ++++ test/create-xliff2-embedded/test.properties | 2 + test/create-xliff2-embedded/topic.dita | 81 ++ test/create-xliff2-glossentry/build.xml | 21 + .../create-xliff2-glossentry/document.ditamap | 10 + test/create-xliff2-glossentry/expected.xlf | 27 + test/create-xliff2-glossentry/glossary.dita | 7 + test/create-xliff2-glossentry/test.properties | 2 + test/create-xliff2-text/build.xml | 21 + test/create-xliff2-text/document.ditamap | 5 + test/create-xliff2-text/expected.xlf | 32 + test/create-xliff2-text/test.properties | 2 + test/create-xliff2-text/topic.dita | 19 + test/create-xliff2-translate-no/build.xml | 53 + .../document.ditamap | 8 + test/create-xliff2-translate-no/expected.xlf | 98 ++ .../notranslate-p.dita | 28 + .../notranslate-sub-topic.dita | 28 + .../notranslate.topic.dita | 28 + .../test.properties | 2 + test/create-xliff2-translate-no/topic.dita | 28 + test/create-xliff2-translate-yes/build.xml | 40 + .../document.ditamap | 5 + test/create-xliff2-translate-yes/expected.xlf | 40 + .../test.properties | 2 + test/create-xliff2-translate-yes/topic.dita | 15 + test/create-xliff2-ul-li-p/build.xml | 39 + test/create-xliff2-ul-li-p/document.ditamap | 5 + test/create-xliff2-ul-li-p/expected.xlf | 46 + test/create-xliff2-ul-li-p/test.properties | 2 + test/create-xliff2-ul-li-p/topic.dita | 28 + test/deepl-response/build.xml | 25 + test/deepl-response/expected.txt | 1 + test/deepl-response/response.json | 6 + test/deepl-response/result.txt | 1 + test/order.xsl | 30 + test/preapproved-cache-xliff1/build.xml | 27 + .../preapproved-cache-xliff1/document.ditamap | 5 + test/preapproved-cache-xliff1/expected.xlf | 35 + test/preapproved-cache-xliff1/test.properties | 2 + test/preapproved-cache-xliff1/topic.dita | 19 + .../translate-cache.xlf | 41 + test/preapproved-cache-xliff2/build.xml | 27 + .../preapproved-cache-xliff2/document.ditamap | 5 + test/preapproved-cache-xliff2/expected.xlf | 33 + test/preapproved-cache-xliff2/test.properties | 2 + test/preapproved-cache-xliff2/topic.dita | 19 + .../translate-cache.xlf | 40 + test/watson-response/build.xml | 26 + test/watson-response/expected.txt | 1 + test/watson-response/response.json | 9 + test/watson-response/result.txt | 1 + test/xliff1-dita-embedded/build.xml | 20 + test/xliff1-dita-embedded/expected.dita | 56 + .../skl/document.ditamap.skl | 40 + test/xliff1-dita-embedded/skl/topic.dita.skl | 56 + test/xliff1-dita-embedded/test.properties | 2 + test/xliff1-dita-embedded/translate.xlf | 77 ++ test/xliff1-dita/build.xml | 20 + test/xliff1-dita/expected.dita | 10 + test/xliff1-dita/skl/document.ditamap.skl | 5 + test/xliff1-dita/skl/topic.dita.skl | 10 + test/xliff1-dita/test.properties | 2 + test/xliff1-dita/translate.xlf | 49 + test/xliff1-translate/build.xml | 20 + test/xliff1-translate/expected.xlf | 31 + test/xliff1-translate/test.properties | 2 + test/xliff1-translate/translate.xlf | 31 + .../xliff-no-translations.xml | 42 + test/xliff2-dita-embedded/build.xml | 20 + test/xliff2-dita-embedded/expected.dita | 56 + .../skl/document.ditamap.skl | 54 + test/xliff2-dita-embedded/skl/topic.dita.skl | 56 + test/xliff2-dita-embedded/test.properties | 2 + test/xliff2-dita-embedded/translate.xlf | 467 +++++++++ test/xliff2-dita/build.xml | 20 + test/xliff2-dita/expected.dita | 10 + test/xliff2-dita/skl/document.ditamap.skl | 5 + test/xliff2-dita/skl/topic.dita.skl | 10 + test/xliff2-dita/test.properties | 2 + test/xliff2-dita/translate.xlf | 41 + test/xliff2-translate/build.xml | 20 + test/xliff2-translate/expected.xlf | 26 + test/xliff2-translate/test.properties | 2 + test/xliff2-translate/translate.xlf | 26 + .../xliff-no-translations.xml | 40 + test/yandex-response/build.xml | 25 + test/yandex-response/expected.txt | 1 + test/yandex-response/response.json | 7 + test/yandex-response/result.txt | 1 + 137 files changed, 5429 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/fox/jason/translate/tasks/BingParseTask.java create mode 100644 src/fox/jason/translate/tasks/DeeplParseTask.java create mode 100644 src/fox/jason/translate/tasks/IterateFilesetTask.java create mode 100644 src/fox/jason/translate/tasks/ReinsertDoctypeTask.java create mode 100644 src/fox/jason/translate/tasks/UrlEncodeTask.java create mode 100644 src/fox/jason/translate/tasks/WatsonParseTask.java create mode 100644 src/fox/jason/translate/tasks/YandexParseTask.java create mode 100644 src/main/resources/fox/jason/translate/antlib.xml create mode 100644 test/bing-response/build.xml create mode 100644 test/bing-response/expected.txt create mode 100644 test/bing-response/response.json create mode 100644 test/bing-response/result.txt create mode 100644 test/bootstrap.xml create mode 100644 test/create-xliff1-embedded/build.xml create mode 100644 test/create-xliff1-embedded/document.ditamap create mode 100644 test/create-xliff1-embedded/expected.xlf create mode 100644 test/create-xliff1-embedded/test.properties create mode 100644 test/create-xliff1-embedded/topic.dita create mode 100644 test/create-xliff1-glossentry/build.xml create mode 100644 test/create-xliff1-glossentry/document.ditamap create mode 100644 test/create-xliff1-glossentry/expected.xlf create mode 100644 test/create-xliff1-glossentry/glossary.dita create mode 100644 test/create-xliff1-glossentry/test.properties create mode 100644 test/create-xliff1-text/build.xml create mode 100644 test/create-xliff1-text/document.ditamap create mode 100644 test/create-xliff1-text/expected.xlf create mode 100644 test/create-xliff1-text/test.properties create mode 100644 test/create-xliff1-text/topic.dita create mode 100644 test/create-xliff1-translate-no/build.xml create mode 100644 test/create-xliff1-translate-no/document.ditamap create mode 100644 test/create-xliff1-translate-no/expected.xlf create mode 100644 test/create-xliff1-translate-no/notranslate-p.dita create mode 100644 test/create-xliff1-translate-no/notranslate-sub-topic.dita create mode 100644 test/create-xliff1-translate-no/notranslate.topic.dita create mode 100644 test/create-xliff1-translate-no/test.properties create mode 100644 test/create-xliff1-translate-no/topic.dita create mode 100644 test/create-xliff1-translate-yes/build.xml create mode 100644 test/create-xliff1-translate-yes/document.ditamap create mode 100644 test/create-xliff1-translate-yes/expected.xlf create mode 100644 test/create-xliff1-translate-yes/test.properties create mode 100644 test/create-xliff1-translate-yes/topic.dita create mode 100644 test/create-xliff2-embedded/build.xml create mode 100644 test/create-xliff2-embedded/document.ditamap create mode 100644 test/create-xliff2-embedded/expected.xlf create mode 100644 test/create-xliff2-embedded/test.properties create mode 100644 test/create-xliff2-embedded/topic.dita create mode 100644 test/create-xliff2-glossentry/build.xml create mode 100644 test/create-xliff2-glossentry/document.ditamap create mode 100644 test/create-xliff2-glossentry/expected.xlf create mode 100644 test/create-xliff2-glossentry/glossary.dita create mode 100644 test/create-xliff2-glossentry/test.properties create mode 100644 test/create-xliff2-text/build.xml create mode 100644 test/create-xliff2-text/document.ditamap create mode 100644 test/create-xliff2-text/expected.xlf create mode 100644 test/create-xliff2-text/test.properties create mode 100644 test/create-xliff2-text/topic.dita create mode 100644 test/create-xliff2-translate-no/build.xml create mode 100644 test/create-xliff2-translate-no/document.ditamap create mode 100644 test/create-xliff2-translate-no/expected.xlf create mode 100644 test/create-xliff2-translate-no/notranslate-p.dita create mode 100644 test/create-xliff2-translate-no/notranslate-sub-topic.dita create mode 100644 test/create-xliff2-translate-no/notranslate.topic.dita create mode 100644 test/create-xliff2-translate-no/test.properties create mode 100644 test/create-xliff2-translate-no/topic.dita create mode 100644 test/create-xliff2-translate-yes/build.xml create mode 100644 test/create-xliff2-translate-yes/document.ditamap create mode 100644 test/create-xliff2-translate-yes/expected.xlf create mode 100644 test/create-xliff2-translate-yes/test.properties create mode 100644 test/create-xliff2-translate-yes/topic.dita create mode 100644 test/create-xliff2-ul-li-p/build.xml create mode 100644 test/create-xliff2-ul-li-p/document.ditamap create mode 100644 test/create-xliff2-ul-li-p/expected.xlf create mode 100644 test/create-xliff2-ul-li-p/test.properties create mode 100644 test/create-xliff2-ul-li-p/topic.dita create mode 100644 test/deepl-response/build.xml create mode 100644 test/deepl-response/expected.txt create mode 100644 test/deepl-response/response.json create mode 100644 test/deepl-response/result.txt create mode 100644 test/order.xsl create mode 100644 test/preapproved-cache-xliff1/build.xml create mode 100644 test/preapproved-cache-xliff1/document.ditamap create mode 100644 test/preapproved-cache-xliff1/expected.xlf create mode 100644 test/preapproved-cache-xliff1/test.properties create mode 100644 test/preapproved-cache-xliff1/topic.dita create mode 100644 test/preapproved-cache-xliff1/translate-cache.xlf create mode 100644 test/preapproved-cache-xliff2/build.xml create mode 100644 test/preapproved-cache-xliff2/document.ditamap create mode 100644 test/preapproved-cache-xliff2/expected.xlf create mode 100644 test/preapproved-cache-xliff2/test.properties create mode 100644 test/preapproved-cache-xliff2/topic.dita create mode 100644 test/preapproved-cache-xliff2/translate-cache.xlf create mode 100644 test/watson-response/build.xml create mode 100644 test/watson-response/expected.txt create mode 100644 test/watson-response/response.json create mode 100644 test/watson-response/result.txt create mode 100644 test/xliff1-dita-embedded/build.xml create mode 100644 test/xliff1-dita-embedded/expected.dita create mode 100644 test/xliff1-dita-embedded/skl/document.ditamap.skl create mode 100644 test/xliff1-dita-embedded/skl/topic.dita.skl create mode 100644 test/xliff1-dita-embedded/test.properties create mode 100644 test/xliff1-dita-embedded/translate.xlf create mode 100644 test/xliff1-dita/build.xml create mode 100644 test/xliff1-dita/expected.dita create mode 100644 test/xliff1-dita/skl/document.ditamap.skl create mode 100644 test/xliff1-dita/skl/topic.dita.skl create mode 100644 test/xliff1-dita/test.properties create mode 100644 test/xliff1-dita/translate.xlf create mode 100644 test/xliff1-translate/build.xml create mode 100644 test/xliff1-translate/expected.xlf create mode 100644 test/xliff1-translate/test.properties create mode 100644 test/xliff1-translate/translate.xlf create mode 100644 test/xliff1-translate/xliff-no-translations.xml create mode 100644 test/xliff2-dita-embedded/build.xml create mode 100644 test/xliff2-dita-embedded/expected.dita create mode 100644 test/xliff2-dita-embedded/skl/document.ditamap.skl create mode 100644 test/xliff2-dita-embedded/skl/topic.dita.skl create mode 100644 test/xliff2-dita-embedded/test.properties create mode 100644 test/xliff2-dita-embedded/translate.xlf create mode 100644 test/xliff2-dita/build.xml create mode 100644 test/xliff2-dita/expected.dita create mode 100644 test/xliff2-dita/skl/document.ditamap.skl create mode 100644 test/xliff2-dita/skl/topic.dita.skl create mode 100644 test/xliff2-dita/test.properties create mode 100644 test/xliff2-dita/translate.xlf create mode 100644 test/xliff2-translate/build.xml create mode 100644 test/xliff2-translate/expected.xlf create mode 100644 test/xliff2-translate/test.properties create mode 100644 test/xliff2-translate/translate.xlf create mode 100644 test/xliff2-translate/xliff-no-translations.xml create mode 100644 test/yandex-response/build.xml create mode 100644 test/yandex-response/expected.txt create mode 100644 test/yandex-response/response.json create mode 100644 test/yandex-response/result.txt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0306867 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +test/** linguist-vendored + +build_dita2translate_template.xml linguist-language=Ant-Build-System +src/main/resources/fox/jason/translate/antlib.xml linguist-language=Ant-Build-System diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..95c6818 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + sonarcloud: + name: SonarCloud Scan + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v3 + - name: Use Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' + - name: SonarCloud Scan + uses: jason-fox/sonarcloud-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_CLOUD_LOGIN: ${{ secrets.SONAR_CLOUD_LOGIN }} + + unit-test: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v3 + - name: Run DITA-OT Unit Test + uses: jason-fox/dita-unit-test-action@master + with: + dita-ot-version: '4.0' + plugin: 'fox.jason.translate.xliff' + env: + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + - uses: actions/upload-artifact@v3 + if: always() + with: + name: test-results + path: test-results.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc69dd5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +**/out/** +**/temp/** +**/tmp/** +build_dita2translate.xml + +**/test/add-translations1/translate.xlf +**/test/approved-translations1/test.properties +**/test/add-translations2/translate.xlf +**/test/approved-translations2/test.properties + +.scannerwork/ + +target/ +classes/ +lib/ant-*.jar +lib/ant-launcher-*.jar + +*~ +.fuse_hidden* +.directory +.Trash-* +.nfs* +*.DS_Store +.AppleDouble +.LSOverride +Icon +._* +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a590c6e --- /dev/null +++ b/pom.xml @@ -0,0 +1,112 @@ + + 4.0.0 + fox.jason + translate + 1.2 + + + + org.apache.ant + ant + [1.10.9,) + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + junit + junit + + + + + + + fox.jason.translate.xliff + dita-ot-plugins + cfg,src,Customization,xsl + target/classes/fox/jason/translate/tasks + lib/*.jar + test + src/fox/jason/translate/tasks/** + https://sonarcloud.io + coverage.xml + coverage.html,test-results.html,pom.xml,coverage.xml + + + + src + + + maven-clean-plugin + 3.1.0 + + + + lib + + + + + + + + maven-dependency-plugin + 3.6.0 + + + generate-resources + + copy-dependencies + + + ${basedir}/lib + runtime + + + + + + + maven-compiler-plugin + 3.11.0 + + 1.8 + 1.8 + ${compilerArgument} + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + ${basedir}/lib + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.9.1.2184 + + + verify + + sonar + + + + + + + diff --git a/src/fox/jason/translate/tasks/BingParseTask.java b/src/fox/jason/translate/tasks/BingParseTask.java new file mode 100644 index 0000000..7c05767 --- /dev/null +++ b/src/fox/jason/translate/tasks/BingParseTask.java @@ -0,0 +1,80 @@ +/* + * This file is part of the DITA-OT Translate Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.translate.tasks; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.json.simple.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +// Microsoft Translation. Copies text translated by Azure cloud services to a file +// + +public class BingParseTask extends Task { + + private String text; + private String outproperty; + private JSONParser parser; + + /** + * Creates a new BingParseTask instance. + */ + public BingParseTask() { + super(); + this.text = null; + this.outproperty = null; + this.parser = new JSONParser(); + } + + /** + * Method setText. + * + * @param text String + */ + public void setText(String text) { + this.text = text; + } + + /** + * Method setOutproperty. + * + * @param outproperty String + */ + public void setOutproperty(String outproperty) { + this.outproperty = outproperty; + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param text - The response from Microsoft Translate + // @param outproperty - The property to output to + if (this.text == null) { + throw new BuildException("You must supply a response from Microsoft Translate"); + } + if (this.outproperty == null) { + throw new BuildException("You must supply a property to output to"); + } + + try { + JSONArray json = (JSONArray) this.parser + .parse(this.text); + JSONArray translations = (JSONArray) ((JSONObject) json.get(0)).get("translations"); + String trans = (String) ((JSONObject) translations.get(0)).get("text"); + trans = trans.replaceAll("\\\\\"", "\""); + trans = trans.replaceAll("class=\"notranslate\"", "translate=\"no\""); + getProject().setProperty(this.outproperty, trans); + } catch (ParseException e) { + throw new BuildException("Unable to translate JSON", e); + } + } +} diff --git a/src/fox/jason/translate/tasks/DeeplParseTask.java b/src/fox/jason/translate/tasks/DeeplParseTask.java new file mode 100644 index 0000000..aca7b1e --- /dev/null +++ b/src/fox/jason/translate/tasks/DeeplParseTask.java @@ -0,0 +1,80 @@ +/* + * This file is part of the DITA-OT Translate Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.translate.tasks; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.json.simple.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +// Watson Translation. Parses the response and extracts the translated text +// + +public class DeeplParseTask extends Task { + + private String text; + private String outproperty; + private JSONParser parser; + + /** + * Creates a new DeeplParseTask instance. + */ + public DeeplParseTask() { + super(); + this.text = null; + this.outproperty = null; + this.parser = new JSONParser(); + } + + /** + * Method setText. + * + * @param text String + */ + public void setText(String text) { + this.text = text; + } + + /** + * Method setOutproperty. + * + * @param outproperty String + */ + public void setOutproperty(String outproperty) { + this.outproperty = outproperty; + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param text - The response from Deepl + // @param outproperty - The property to output to + if (this.text == null) { + throw new BuildException("You must supply a response from Deepl"); + } + if (this.outproperty == null) { + throw new BuildException("You must supply a property to output to"); + } + + try { + JSONObject json = (JSONObject) this.parser + .parse(this.text); + JSONArray translations = (JSONArray) json.get("translations"); + String trans = (String) ((JSONObject) translations.get(0)).get("text"); + trans = trans.replaceAll("\\\\\"", "\""); + getProject().setProperty(this.outproperty, trans); + } catch (ParseException e) { + throw new BuildException("Unable to translate JSON", e); + } + + } +} diff --git a/src/fox/jason/translate/tasks/IterateFilesetTask.java b/src/fox/jason/translate/tasks/IterateFilesetTask.java new file mode 100644 index 0000000..6762ba6 --- /dev/null +++ b/src/fox/jason/translate/tasks/IterateFilesetTask.java @@ -0,0 +1,124 @@ +/* + * This file is part of the DITA-OT Pretty DITA Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.translate.tasks; + +import java.util.ArrayList; +import java.util.List; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.taskdefs.MacroInstance; +import org.apache.tools.ant.types.FileSet; + +// +// Iterator function to run a given macro against a set of files +// + +public class IterateFilesetTask extends Task { + /** + * Field filesets. + */ + private List filesets; + /** + * Field todir. + */ + private String macro; + /** + * Field todir. + */ + private String todir; + + /** + * Field dir. + */ + private String dir; + + /** + * Creates a new IterateFilesetTask instance. + */ + public IterateFilesetTask() { + super(); + this.dir = null; + this.todir = null; + this.macro = null; + this.filesets = new ArrayList<>(); + } + + /** + * Method setDir. + * + * @param dir String + */ + public void setDir(String dir) { + this.dir = dir; + } + + /** + * Method setTodir. + * + * @param todir String + */ + public void setTodir(String todir) { + this.todir = todir; + } + + /** + * Method setMacro. + * + * @param macro String + */ + public void setMacro(String macro) { + this.macro = macro; + } + + /** + * @param set FileSet + */ + public void addFileset(FileSet set) { + this.filesets.add(set); + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param toDir - The output location of the files + // @param dir - The location of the files to process + // @param macro - A macro to run. + // @param fileset - A set of files + if (this.dir == null) { + throw new BuildException("You must supply a source directory"); + } + if (this.macro == null) { + throw new BuildException("You must supply a macro"); + } + if (filesets.isEmpty()) { + throw new BuildException("You must supply a set of files"); + } + + for (FileSet fileset : this.filesets) { + DirectoryScanner scanner = fileset.getDirectoryScanner(getProject()); + scanner.scan(); + + for (String file : scanner.getIncludedFiles()) { + MacroInstance task = (MacroInstance) getProject() + .createTask(this.macro); + try { + task.setDynamicAttribute("file", this.dir + "/" + file); + if (this.todir != null){ + task.setDynamicAttribute("toDir", this.todir); + } + task.execute(); + } catch (Exception err) { + throw new BuildException(err); + } + } + } + } +} \ No newline at end of file diff --git a/src/fox/jason/translate/tasks/ReinsertDoctypeTask.java b/src/fox/jason/translate/tasks/ReinsertDoctypeTask.java new file mode 100644 index 0000000..ed5b6b7 --- /dev/null +++ b/src/fox/jason/translate/tasks/ReinsertDoctypeTask.java @@ -0,0 +1,201 @@ +/* + * This file is part of the DITA-OT Translate Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.translate.tasks; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import java.util.regex.Pattern; +import org.apache.tools.ant.taskdefs.Echo; +import org.apache.tools.ant.util.FileUtils; + +// Iterator function to run a given macro against a set of files +// + +public class ReinsertDoctypeTask extends Task { + + private String file; + /** + * Creates a new ReinsertDoctypeTask instance. + */ + public ReinsertDoctypeTask() { + super(); + this.file = null; + } + + private void addDoctype(String doctype, List textArr){ + if (doctype.contains(" ")) { + doctype = doctype.substring(0, doctype.indexOf(' ')); + } + + textArr.add(""); + } + + // Standard Doctype replacements + private String getDoctype(String doctype) { + String type = null; + + switch (doctype.toLowerCase()) { + case "concept": + type = "PUBLIC \"-//OASIS//DTD DITA Concept//EN\" \"concept.dtd\""; + break; + case "ditabase": + type = "PUBLIC \"-//OASIS//DTD DITA Composite//EN\" \"ditabase.dtd\""; + break; + case "glossentry": + type = + "PUBLIC \"-//OASIS//DTD DITA Glossary Entry//EN\" \"glossentry.dtd\""; + break; + case "glossary": + type = "PUBLIC \"-//OASIS//DTD DITA Glossary//EN\" \"glossary.dtd\""; + break; + case "reference": + type = "PUBLIC \"-//OASIS//DTD DITA Reference//EN\" \"reference.dtd\""; + break; + case "task": + type = "PUBLIC \"-//OASIS//DTD DITA Task//EN\" \"task.dtd\""; + break; + case "generaltask": + type = + "PUBLIC \"-//OASIS//DTD DITA General Task//EN\" \"generalTask.dtd\""; + break; + case "topic": + type = "PUBLIC \"-//OASIS//DTD DITA Topic//EN\" \"topic.dtd\""; + break; + case "basetopic": + type = "PUBLIC \"-//OASIS//DTD DITA Base Topic//EN\" \"basetopic.dtd\""; + break; + case "machinerytask": + type = + "PUBLIC \"-//OASIS//DTD DITA Machinery Task//EN\" \"machineryTask.dtd\""; + break; + case "learningassessment": + type = + "PUBLIC \"-//OASIS//DTD DITA Learning Assessment//EN\" \"learningAssessment.dtd\""; + break; + case "learningcontent": + type = + "PUBLIC \"-//OASIS//DTD DITA Learning Content//EN\" \"learningContent.dtd\""; + break; + case "learningoverview": + type = + "PUBLIC \"-//OASIS//DTD DITA Learning Overview//EN\" \"learningOverview.dtd\""; + break; + case "learningplan": + type = + "PUBLIC \"-//OASIS//DTD DITA Learning Plan//EN\" \"learningPlan.dtd\""; + break; + case "learningsummary": + type = + "PUBLIC \"-//OASIS//DTD DITA Learning Summary//EN\" \"learningSummary.dtd\""; + break; + case "map": + type = "PUBLIC \"-//OASIS//DTD DITA Map//EN\" \"map.dtd\""; + break; + case "basemap": + type = "PUBLIC \"-//OASIS//DTD DITA Base Map//EN\" \"basemap.dtd\""; + break; + case "bookmap": + type = "PUBLIC \"-//OASIS//DTD DITA BookMap//EN\" \"bookmap.dtd\""; + break; + case "subjectscheme": + type = + "PUBLIC \"-//OASIS//DTD DITA Subject Scheme Map//EN\" \"subjectScheme.dtd\""; + break; + case "classifymap": + type = + "PUBLIC \"-//OASIS//DTD DITA Classification Map//EN\" \"classifyMap.dtd\""; + break; + case "learningbookmap": + type = + "PUBLIC \"-//OASIS//DTD DITA Learning BookMap//EN\" \"learningBookmap.dtd\""; + break; + case "learningmap": + type = + "PUBLIC \"-//OASIS//DTD DITA Learning Map//EN\" \"learningMap.dtd\""; + break; + case "ditaval": + type = "PUBLIC \"-//OASIS//DTD DITA DITAVAL//EN\" \"ditaval.dtd\""; + break; + default: + getProject().log("Unknown Doctype: " + doctype, 1); + } + return type; + } + + private String addDoctype(String dita) { + String[] lines = dita.split("\n"); + List text = new ArrayList<>(); + String doctype = null; + Pattern reDoctype = Pattern.compile("^<\\w"); + + for (String line : lines) { + if (doctype == null && reDoctype.matcher(line).lookingAt()) { + int start = line.indexOf('<'); + int end = line.indexOf('>'); + int space = line.indexOf(' '); + + if(space > 0 && (space < end || end == -1)){ + end = space; + } + + doctype = line.substring(start + 1, end); + addDoctype(doctype, text); + } + if (line.length() > 0) { + text.add(line); + } + } + return String.join("\n", text); + } + + /** + * Method setFile. + * + * @param file String + */ + public void setFile(String file) { + this.file = file; + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param file - A file to add a doctype to + if (this.file == null) { + throw new BuildException("You must supply a file to add a doctype to"); + } + + try { + String input = FileUtils.readFully( + new java.io.FileReader(this.file) + ); + String output = addDoctype(input); + Echo task = (Echo) getProject().createTask("echo"); + task.setFile(new java.io.File(file)); + task.setMessage(output); + task.perform(); + } catch (IOException e) { + throw new BuildException("Unable to read file", e); + } + + } +} + + + + + + + + + diff --git a/src/fox/jason/translate/tasks/UrlEncodeTask.java b/src/fox/jason/translate/tasks/UrlEncodeTask.java new file mode 100644 index 0000000..8ae79fb --- /dev/null +++ b/src/fox/jason/translate/tasks/UrlEncodeTask.java @@ -0,0 +1,78 @@ +/* + * This file is part of the DITA-OT Translate Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.translate.tasks; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.io.UnsupportedEncodingException; + +// +// Converts a value to URI Encoding +// + +public class UrlEncodeTask extends Task { + + private String to; + private String string; + + /** + * Creates a new UriEncodeTask instance. + */ + public UrlEncodeTask() { + super(); + this.to = null; + this.string = null; + } + + /** + * Method setTo. + * + * @param to String + */ + public void setTo(String to) { + this.to = to; + } + + /** + * Method setString. + * + * @param string String + */ + public void setString(String string) { + this.string = string; + } + + // Method to encode a string value using `UTF-8` encoding scheme + private String encodeURIComponent(String value) { + try { + return URLEncoder.encode(value, StandardCharsets.UTF_8.toString()); + } catch (UnsupportedEncodingException ex) { + throw new BuildException("Unable to encode URI", ex); + } + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + + // @param string - The value to convert + // @param to - The property to set + if (this.string == null) { + throw new BuildException("You must supply a value to convert"); + } + if (this.to == null) { + throw new BuildException("You must supply a property to set"); + } + + getProject().setProperty(this.to, encodeURIComponent(this.string)); + } +} diff --git a/src/fox/jason/translate/tasks/WatsonParseTask.java b/src/fox/jason/translate/tasks/WatsonParseTask.java new file mode 100644 index 0000000..36bcff6 --- /dev/null +++ b/src/fox/jason/translate/tasks/WatsonParseTask.java @@ -0,0 +1,80 @@ +/* + * This file is part of the DITA-OT Translate Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.translate.tasks; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.json.simple.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +// +// Watson Translation. Parses the response and extracts the translated text +// + +public class WatsonParseTask extends Task { + + private String text; + private String outproperty; + private JSONParser parser; + + /** + * Creates a new WatsonParseTask instance. + */ + public WatsonParseTask() { + super(); + this.text = null; + this.outproperty = null; + this.parser = new JSONParser(); + } + + /** + * Method setText. + * + * @param text String + */ + public void setText(String text) { + this.text = text; + } + + /** + * Method setOutproperty. + * + * @param outproperty String + */ + public void setOutproperty(String outproperty) { + this.outproperty = outproperty; + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param text - The response from Watson Translate + // @param outproperty - The property to output to + if (this.text == null) { + throw new BuildException("You must supply a response from Watson Translate"); + } + if (this.outproperty == null) { + throw new BuildException("You must supply a property to output to"); + } + + try { + JSONObject json = (JSONObject) this.parser + .parse(this.text); + + JSONArray translations = (JSONArray) json.get("translations"); + String trans = (String) ((JSONObject) translations.get(0)).get("translation"); + getProject().setProperty(this.outproperty, trans); + } catch (ParseException e) { + throw new BuildException("Unable to translate JSON", e); + } + } +} diff --git a/src/fox/jason/translate/tasks/YandexParseTask.java b/src/fox/jason/translate/tasks/YandexParseTask.java new file mode 100644 index 0000000..97bd8f4 --- /dev/null +++ b/src/fox/jason/translate/tasks/YandexParseTask.java @@ -0,0 +1,82 @@ +/* + * This file is part of the DITA-OT Translate Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.translate.tasks; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.json.simple.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +// +// Yandex Translation. Parses the response and extracts the translated text +// + +public class YandexParseTask extends Task { + + private String text; + private String outproperty; + private JSONParser parser; + + /** + * Creates a new YandexParseTask instance. + */ + public YandexParseTask() { + super(); + this.text = null; + this.outproperty = null; + this.parser = new JSONParser(); + } + + /** + * Method setText. + * + * @param text String + */ + public void setText(String text) { + this.text = text; + } + + /** + * Method setOutproperty. + * + * @param outproperty String + */ + public void setOutproperty(String outproperty) { + this.outproperty = outproperty; + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param text - The response from Yandex Translate + // @param outproperty - The property to output to + if (this.text == null) { + throw new BuildException("You must supply a response from Yandex Translate"); + } + if (this.outproperty == null) { + throw new BuildException("You must supply a property to output to"); + } + + try { + JSONObject json = (JSONObject) this.parser + .parse(this.text); + JSONArray texts = (JSONArray) json.get("text"); + String trans = (String) texts.get(0); + trans = trans.replaceAll("\\\\\"", "\""); + trans = trans.replaceAll("class=\"notranslate\"", "translate=\"no\""); + getProject().setProperty(this.outproperty, trans); + } catch (ParseException e) { + throw new BuildException("Unable to translate JSON", e); + } + + } +} diff --git a/src/main/resources/fox/jason/translate/antlib.xml b/src/main/resources/fox/jason/translate/antlib.xml new file mode 100644 index 0000000..c72d8b6 --- /dev/null +++ b/src/main/resources/fox/jason/translate/antlib.xml @@ -0,0 +1,986 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@@@@${target.dita.id}@@@@@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/bing-response/build.xml b/test/bing-response/build.xml new file mode 100644 index 0000000..872edd3 --- /dev/null +++ b/test/bing-response/build.xml @@ -0,0 +1,25 @@ + + + + + + + Expect that Bing translations can be read. + + + + + + + + + + + + diff --git a/test/bing-response/expected.txt b/test/bing-response/expected.txt new file mode 100644 index 0000000..4863a82 --- /dev/null +++ b/test/bing-response/expected.txt @@ -0,0 +1 @@ +你好, 你叫什么名字? diff --git a/test/bing-response/response.json b/test/bing-response/response.json new file mode 100644 index 0000000..3dfa503 --- /dev/null +++ b/test/bing-response/response.json @@ -0,0 +1,7 @@ +[ + { + "translations":[ + {"text":"你好, 你叫什么名字?","to":"zh-Hans"} + ] + } +] \ No newline at end of file diff --git a/test/bing-response/result.txt b/test/bing-response/result.txt new file mode 100644 index 0000000..4863a82 --- /dev/null +++ b/test/bing-response/result.txt @@ -0,0 +1 @@ +你好, 你叫什么名字? diff --git a/test/bootstrap.xml b/test/bootstrap.xml new file mode 100644 index 0000000..55235c7 --- /dev/null +++ b/test/bootstrap.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/create-xliff1-embedded/build.xml b/test/create-xliff1-embedded/build.xml new file mode 100644 index 0000000..4ce6abd --- /dev/null +++ b/test/create-xliff1-embedded/build.xml @@ -0,0 +1,27 @@ + + + + + + Expect that DITA with embedded elements can be transformed into an XLIFF 1.2 file + + + + + + + + + + diff --git a/test/create-xliff1-embedded/document.ditamap b/test/create-xliff1-embedded/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/create-xliff1-embedded/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/create-xliff1-embedded/expected.xlf b/test/create-xliff1-embedded/expected.xlf new file mode 100644 index 0000000..633fda3 --- /dev/null +++ b/test/create-xliff1-embedded/expected.xlf @@ -0,0 +1,87 @@ + + + + +
+ + + +
+ + + Basic usage + + + + You will need to include the + prism.cssand + prism.jsfiles you downloaded in your page. Example: + + + + Prism does its best to encourage good authoring practices. Therefore,it only works with + <code>elements, since marking upcode without a + <code>element is semantically invalid. + According to the HTML5 spec, the recommended way to define a code language is a + language-xxxxclass, which is what Prism uses. Alternatively, Prism also supports a shorter version: + lang-xxxx. + + + + To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple + <code>elements have the same language, you can add the + language-xxxxclass on one of their common ancestors. This way, you can also define a document-wide default language, by adding a + language-xxxxclass on the + <body>or + <html>element. + + + + If you want to opt-out of highlighting for a + <code>element that is a descendant of an element with a declared code language, you can add the class + language-noneto it (or any non-existing language, really). + + + + The + recommended way to mark up a code block(both for semantics and for Prism) is a + <pre>element with a + <code>element inside, like so: + + + + If you use that pattern, the + <pre>will automatically get the + language-xxxxclass (if it doesn’t already have it) and will be styled as a code block. + + + + If you want to prevent any elements from being automatically highlighted, you can use the attribute + data-manualon the + <script>element you used for prism and use the + API. Example: + + + + Usage with Webpack, Browserify, & Other Bundlers + + + + If you want to use Prism with a bundler, install Prism with + npm: + + + + You can then + importinto your bundle + + + + To make it easy to configure your Prism instance with only thelanguages and plugins you need, use the babel plugin, + babel-plugin-prismjs. This will allow you to load the minimum number of languages and plugins to satisfy your needs. See that plugin's documentation for configuration details + + + +
+
+ diff --git a/test/create-xliff1-embedded/test.properties b/test/create-xliff1-embedded/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/create-xliff1-embedded/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/create-xliff1-embedded/topic.dita b/test/create-xliff1-embedded/topic.dita new file mode 100644 index 0000000..5c81967 --- /dev/null +++ b/test/create-xliff1-embedded/topic.dita @@ -0,0 +1,81 @@ + + + + Basic usage + +

+ You will need to include the prism.css and prism.js + files you downloaded in your page. Example: +

+ <!DOCTYPE html> +<html> +<head> + ... + <link href="themes/prism.css" rel="stylesheet" /> + ></head> +<body> + ... + <script src="prism.js"></script> + </body> +</html> +

+ Prism does its best to encourage good authoring practices. Therefore,it only + works with <code> elements, since marking upcode + without a <code> element is semantically invalid.According + to the HTML5 spec, the recommended way to define a code language is a language-xxxx + class, which is what Prism uses. Alternatively, Prism also supports a shorter version: lang-xxxx. +

+

+ To make things easier however, Prism assumes that this language definition is + inherited. Therefore, if multiple <code> elements have + the same language, you can add the language-xxxx class on one + of their common ancestors. This way, you can also define a document-wide + default language, by adding a language-xxxx class on the <body> + or <html> element. +

+

+ If you want to opt-out of highlighting for a <code> + element that is a descendant of an element with a declared code language, you + can add the class language-none to it (or any non-existing + language, really). +

+

+ The recommended + way to mark up a code block (both for semantics and for Prism) is a <pre> + element with a <code> element inside, like so: +

+ <pre><code class="language-css">p { color: red }</code></pre> +

+ If you use that pattern, the <pre> will automatically get + the language-xxxx class (if it doesn’t already have it) and + will be styled as a code block. +

+

+ If you want to prevent any elements from being automatically highlighted, you + can use the attribute data-manual on the <script> + element you used for prism and use the API. Example: +

+
+ Usage with Webpack, Browserify, & Other Bundlers +

+ If you want to use Prism with a bundler, install Prism with npm: +

+ $ npm install prismjs +

+ You can then import into your bundle +

+ import Prism from 'prismjs'; +

+ To make it easy to configure your Prism instance with only thelanguages and + plugins you need, use the babel plugin, babel-plugin-prismjs. + This will allow you to load the minimum number of languages and plugins to + satisfy your needs. See that plugin's documentation for configuration details +

+
+ +
diff --git a/test/create-xliff1-glossentry/build.xml b/test/create-xliff1-glossentry/build.xml new file mode 100644 index 0000000..ae0f223 --- /dev/null +++ b/test/create-xliff1-glossentry/build.xml @@ -0,0 +1,21 @@ + + + + + + Expect that a DITA glossentry can be transformed into an XLIFF 1.2 file + + + + + + + + + diff --git a/test/create-xliff1-glossentry/document.ditamap b/test/create-xliff1-glossentry/document.ditamap new file mode 100644 index 0000000..8a6ffd3 --- /dev/null +++ b/test/create-xliff1-glossentry/document.ditamap @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/test/create-xliff1-glossentry/expected.xlf b/test/create-xliff1-glossentry/expected.xlf new file mode 100644 index 0000000..f848e4d --- /dev/null +++ b/test/create-xliff1-glossentry/expected.xlf @@ -0,0 +1,23 @@ + + + + +
+ + + +
+ + + Mnemonics + + + + + Mnemonicsare keywords by which each of the instrument's subsystems is referred to. + + + +
+
+ diff --git a/test/create-xliff1-glossentry/glossary.dita b/test/create-xliff1-glossentry/glossary.dita new file mode 100644 index 0000000..bc10203 --- /dev/null +++ b/test/create-xliff1-glossentry/glossary.dita @@ -0,0 +1,7 @@ + + + + Mnemonics + Mnemonics are keywords by which each + of the instrument's subsystems is referred to. + \ No newline at end of file diff --git a/test/create-xliff1-glossentry/test.properties b/test/create-xliff1-glossentry/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/create-xliff1-glossentry/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/create-xliff1-text/build.xml b/test/create-xliff1-text/build.xml new file mode 100644 index 0000000..fdfc9e1 --- /dev/null +++ b/test/create-xliff1-text/build.xml @@ -0,0 +1,21 @@ + + + + + + Expect that simple DITA texts can be transformed into an XLIFF 1.2 file + + + + + + + + + diff --git a/test/create-xliff1-text/document.ditamap b/test/create-xliff1-text/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/create-xliff1-text/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/create-xliff1-text/expected.xlf b/test/create-xliff1-text/expected.xlf new file mode 100644 index 0000000..dacdcb6 --- /dev/null +++ b/test/create-xliff1-text/expected.xlf @@ -0,0 +1,30 @@ + + + + +
+ + + +
+ + + Cicero + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + +
+
+ diff --git a/test/create-xliff1-text/test.properties b/test/create-xliff1-text/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/create-xliff1-text/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/create-xliff1-text/topic.dita b/test/create-xliff1-text/topic.dita new file mode 100644 index 0000000..8123b10 --- /dev/null +++ b/test/create-xliff1-text/topic.dita @@ -0,0 +1,19 @@ + + Cicero + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
\ No newline at end of file diff --git a/test/create-xliff1-translate-no/build.xml b/test/create-xliff1-translate-no/build.xml new file mode 100644 index 0000000..eef21f3 --- /dev/null +++ b/test/create-xliff1-translate-no/build.xml @@ -0,0 +1,73 @@ + + + + + + Expect that DITA block elements with translate='no' are ignored in XLIFF 1.2 + + + + + + + + + + + + + + + + + + + + + diff --git a/test/create-xliff1-translate-no/document.ditamap b/test/create-xliff1-translate-no/document.ditamap new file mode 100644 index 0000000..bbc7769 --- /dev/null +++ b/test/create-xliff1-translate-no/document.ditamap @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/test/create-xliff1-translate-no/expected.xlf b/test/create-xliff1-translate-no/expected.xlf new file mode 100644 index 0000000..86a76e0 --- /dev/null +++ b/test/create-xliff1-translate-no/expected.xlf @@ -0,0 +1,74 @@ + + + + +
+ + + +
+ + + Cicero + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + +
+ +
+ + + +
+ + + Cicero + + + + The following lines are the origin of + Lorem Ipsum: + + + +
+ +
+ + + +
+ + + Cicero + + + + The following lines are the origin of + Lorem Ipsum: + + + + Loves or pursues or desires to obtain + pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + + +
+
+ diff --git a/test/create-xliff1-translate-no/notranslate-p.dita b/test/create-xliff1-translate-no/notranslate-p.dita new file mode 100644 index 0000000..2d1e989 --- /dev/null +++ b/test/create-xliff1-translate-no/notranslate-p.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+ + + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
+
\ No newline at end of file diff --git a/test/create-xliff1-translate-no/notranslate-sub-topic.dita b/test/create-xliff1-translate-no/notranslate-sub-topic.dita new file mode 100644 index 0000000..ba6e677 --- /dev/null +++ b/test/create-xliff1-translate-no/notranslate-sub-topic.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+ + + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
+
\ No newline at end of file diff --git a/test/create-xliff1-translate-no/notranslate.topic.dita b/test/create-xliff1-translate-no/notranslate.topic.dita new file mode 100644 index 0000000..c598422 --- /dev/null +++ b/test/create-xliff1-translate-no/notranslate.topic.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+
    +
  • + Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +
  • +
  • +

    + To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

    +

    + But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

    +
  • +
+ +
\ No newline at end of file diff --git a/test/create-xliff1-translate-no/test.properties b/test/create-xliff1-translate-no/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/create-xliff1-translate-no/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/create-xliff1-translate-no/topic.dita b/test/create-xliff1-translate-no/topic.dita new file mode 100644 index 0000000..f0e2d96 --- /dev/null +++ b/test/create-xliff1-translate-no/topic.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+
    +
  • + Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +
  • +
  • +

    + To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

    +

    + But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

    +
  • +
+ +
diff --git a/test/create-xliff1-translate-yes/build.xml b/test/create-xliff1-translate-yes/build.xml new file mode 100644 index 0000000..33fd733 --- /dev/null +++ b/test/create-xliff1-translate-yes/build.xml @@ -0,0 +1,40 @@ + + + + + + Expect that DITA block elements with translate='yes' are included in XLIFF 1.2 + + + + + + + + + + + + + diff --git a/test/create-xliff1-translate-yes/document.ditamap b/test/create-xliff1-translate-yes/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/create-xliff1-translate-yes/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/create-xliff1-translate-yes/expected.xlf b/test/create-xliff1-translate-yes/expected.xlf new file mode 100644 index 0000000..c703fad --- /dev/null +++ b/test/create-xliff1-translate-yes/expected.xlf @@ -0,0 +1,28 @@ + + + + +
+ + + +
+ + + Cicero + + + + The following lines are the origin of + Lorem Ipsum: + + + + Loves or pursues or desires to obtain + pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + + +
+
+ diff --git a/test/create-xliff1-translate-yes/test.properties b/test/create-xliff1-translate-yes/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/create-xliff1-translate-yes/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/create-xliff1-translate-yes/topic.dita b/test/create-xliff1-translate-yes/topic.dita new file mode 100644 index 0000000..a4c84f1 --- /dev/null +++ b/test/create-xliff1-translate-yes/topic.dita @@ -0,0 +1,15 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+

+ Loves or pursues or desires to obtain pain of itself, + because it is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+ +
diff --git a/test/create-xliff2-embedded/build.xml b/test/create-xliff2-embedded/build.xml new file mode 100644 index 0000000..aca60d0 --- /dev/null +++ b/test/create-xliff2-embedded/build.xml @@ -0,0 +1,39 @@ + + + + + + Expect that DITA with embedded elements can be transformed into an XLIFF 2.0 file + + + + + + + + + + + + diff --git a/test/create-xliff2-embedded/document.ditamap b/test/create-xliff2-embedded/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/create-xliff2-embedded/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/create-xliff2-embedded/expected.xlf b/test/create-xliff2-embedded/expected.xlf new file mode 100644 index 0000000..6c3f0d0 --- /dev/null +++ b/test/create-xliff2-embedded/expected.xlf @@ -0,0 +1,217 @@ + + + + + + + + Basic usage + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + + + You will need to include the + + prism.css + and + + prism.js + files you downloaded in your page. Example: + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + <xref format="html" scope="external" href="https://www.w3.org/TR/html52/textlevel-semantics.html#the-code-element"> + </xref> + <codeph> + </codeph> + <codeph> + </codeph> + + + Prism does its best to encourage good authoring practices. Therefore,it only works with + + <code> + elements, since marking upcode without a + + <code> + element is semantically invalid. + , the recommended way to define a code language is a + + language-xxxx + class, which is what Prism uses. Alternatively, Prism also supports a shorter version: + + lang-xxxx + . + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + + + To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple + + <code> + elements have the same language, you can add the + + language-xxxx + class on one of their common ancestors. This way, you can also define a document-wide default language, by adding a + + language-xxxx + class on the + + <body> + or + + <html> + element. + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + + + If you want to opt-out of highlighting for a + + <code> + element that is a descendant of an element with a declared code language, you can add the class + + language-none + to it (or any non-existing language, really). + + + + + + <xref format="html" scope="external" href="https://www.w3.org/TR/html5/grouping-content.html#the-pre-element"> + </xref> + <codeph> + </codeph> + <codeph> + </codeph> + + + The + (both for semantics and for Prism) is a + + <pre> + element with a + + <code> + element inside, like so: + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + + + If you use that pattern, the + + <pre> + will automatically get the + + language-xxxx + class (if it doesn’t already have it) and will be styled as a code block. + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + <xref format="html" scope="external" href="https://prismjs.com/extending.html#api"> + </xref> + + + If you want to prevent any elements from being automatically highlighted, you can use the attribute + + data-manual + on the + + <script> + element you used for prism and use the + + + + + + + Usage with Webpack, Browserify, & Other Bundlers + + + + + + <codeph> + </codeph> + + + If you want to use Prism with a bundler, install Prism with + + npm + : + + + + + + <codeph outputclass="language-js"> + </codeph> + + + You can then + + import + into your bundle + + + + + + <xref format="html" scope="external" href="https://github.com/mAAdhaTTah/babel-plugin-prismjs"> + </xref> + + + To make it easy to configure your Prism instance with only thelanguages and plugins you need, use the babel plugin, + + + + + + + diff --git a/test/create-xliff2-embedded/test.properties b/test/create-xliff2-embedded/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/create-xliff2-embedded/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/create-xliff2-embedded/topic.dita b/test/create-xliff2-embedded/topic.dita new file mode 100644 index 0000000..5c81967 --- /dev/null +++ b/test/create-xliff2-embedded/topic.dita @@ -0,0 +1,81 @@ + + + + Basic usage + +

+ You will need to include the prism.css and prism.js + files you downloaded in your page. Example: +

+ <!DOCTYPE html> +<html> +<head> + ... + <link href="themes/prism.css" rel="stylesheet" /> + ></head> +<body> + ... + <script src="prism.js"></script> + </body> +</html> +

+ Prism does its best to encourage good authoring practices. Therefore,it only + works with <code> elements, since marking upcode + without a <code> element is semantically invalid.According + to the HTML5 spec, the recommended way to define a code language is a language-xxxx + class, which is what Prism uses. Alternatively, Prism also supports a shorter version: lang-xxxx. +

+

+ To make things easier however, Prism assumes that this language definition is + inherited. Therefore, if multiple <code> elements have + the same language, you can add the language-xxxx class on one + of their common ancestors. This way, you can also define a document-wide + default language, by adding a language-xxxx class on the <body> + or <html> element. +

+

+ If you want to opt-out of highlighting for a <code> + element that is a descendant of an element with a declared code language, you + can add the class language-none to it (or any non-existing + language, really). +

+

+ The recommended + way to mark up a code block (both for semantics and for Prism) is a <pre> + element with a <code> element inside, like so: +

+ <pre><code class="language-css">p { color: red }</code></pre> +

+ If you use that pattern, the <pre> will automatically get + the language-xxxx class (if it doesn’t already have it) and + will be styled as a code block. +

+

+ If you want to prevent any elements from being automatically highlighted, you + can use the attribute data-manual on the <script> + element you used for prism and use the API. Example: +

+
+ Usage with Webpack, Browserify, & Other Bundlers +

+ If you want to use Prism with a bundler, install Prism with npm: +

+ $ npm install prismjs +

+ You can then import into your bundle +

+ import Prism from 'prismjs'; +

+ To make it easy to configure your Prism instance with only thelanguages and + plugins you need, use the babel plugin, babel-plugin-prismjs. + This will allow you to load the minimum number of languages and plugins to + satisfy your needs. See that plugin's documentation for configuration details +

+
+ +
diff --git a/test/create-xliff2-glossentry/build.xml b/test/create-xliff2-glossentry/build.xml new file mode 100644 index 0000000..3a06966 --- /dev/null +++ b/test/create-xliff2-glossentry/build.xml @@ -0,0 +1,21 @@ + + + + + + Expect that simple DITA glossentry can be transformed into an XLIFF 2.1 file + + + + + + + + + diff --git a/test/create-xliff2-glossentry/document.ditamap b/test/create-xliff2-glossentry/document.ditamap new file mode 100644 index 0000000..8a6ffd3 --- /dev/null +++ b/test/create-xliff2-glossentry/document.ditamap @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/test/create-xliff2-glossentry/expected.xlf b/test/create-xliff2-glossentry/expected.xlf new file mode 100644 index 0000000..60121f3 --- /dev/null +++ b/test/create-xliff2-glossentry/expected.xlf @@ -0,0 +1,27 @@ + + + + + + + + Mnemonics + + + + + + <term> + </term> + + + + + Mnemonics + are keywords by which each of the instrument's subsystems is referred to. + + + + + + diff --git a/test/create-xliff2-glossentry/glossary.dita b/test/create-xliff2-glossentry/glossary.dita new file mode 100644 index 0000000..bc10203 --- /dev/null +++ b/test/create-xliff2-glossentry/glossary.dita @@ -0,0 +1,7 @@ + + + + Mnemonics + Mnemonics are keywords by which each + of the instrument's subsystems is referred to. + \ No newline at end of file diff --git a/test/create-xliff2-glossentry/test.properties b/test/create-xliff2-glossentry/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/create-xliff2-glossentry/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/create-xliff2-text/build.xml b/test/create-xliff2-text/build.xml new file mode 100644 index 0000000..9d659e1 --- /dev/null +++ b/test/create-xliff2-text/build.xml @@ -0,0 +1,21 @@ + + + + + + Expect that simple DITA texts can be transformed into an XLIFF 2.1 file + + + + + + + + + diff --git a/test/create-xliff2-text/document.ditamap b/test/create-xliff2-text/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/create-xliff2-text/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/create-xliff2-text/expected.xlf b/test/create-xliff2-text/expected.xlf new file mode 100644 index 0000000..1cf42b3 --- /dev/null +++ b/test/create-xliff2-text/expected.xlf @@ -0,0 +1,32 @@ + + + + + + + + Cicero + + + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + + + + diff --git a/test/create-xliff2-text/test.properties b/test/create-xliff2-text/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/create-xliff2-text/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/create-xliff2-text/topic.dita b/test/create-xliff2-text/topic.dita new file mode 100644 index 0000000..8123b10 --- /dev/null +++ b/test/create-xliff2-text/topic.dita @@ -0,0 +1,19 @@ + + Cicero + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
\ No newline at end of file diff --git a/test/create-xliff2-translate-no/build.xml b/test/create-xliff2-translate-no/build.xml new file mode 100644 index 0000000..baf3918 --- /dev/null +++ b/test/create-xliff2-translate-no/build.xml @@ -0,0 +1,53 @@ + + + + + + Expect that DITA block elements with translate='no' are ignored in XLIFF 2.1 + + + + + + + + + + + + + + + + diff --git a/test/create-xliff2-translate-no/document.ditamap b/test/create-xliff2-translate-no/document.ditamap new file mode 100644 index 0000000..bbc7769 --- /dev/null +++ b/test/create-xliff2-translate-no/document.ditamap @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/test/create-xliff2-translate-no/expected.xlf b/test/create-xliff2-translate-no/expected.xlf new file mode 100644 index 0000000..a40b126 --- /dev/null +++ b/test/create-xliff2-translate-no/expected.xlf @@ -0,0 +1,98 @@ + + + + + + + + Cicero + + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + + + + + + + Cicero + + + + + + <term> + </term> + + + The following lines are the origin of + + Lorem Ipsum + : + + + + + + + + + Cicero + + + + + + <term translate="no" xml:lang="la"> + </term> + + + The following lines are the origin of + + Lorem Ipsum + : + + + + + + <codeph> + </codeph> + + + Loves or pursues or desires to obtain + + pain of itself + , because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + + + + + <p> + </p> + <p> + </p> + + + + + + + + + + + + diff --git a/test/create-xliff2-translate-no/notranslate-p.dita b/test/create-xliff2-translate-no/notranslate-p.dita new file mode 100644 index 0000000..2d1e989 --- /dev/null +++ b/test/create-xliff2-translate-no/notranslate-p.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+ + + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
+
\ No newline at end of file diff --git a/test/create-xliff2-translate-no/notranslate-sub-topic.dita b/test/create-xliff2-translate-no/notranslate-sub-topic.dita new file mode 100644 index 0000000..ba6e677 --- /dev/null +++ b/test/create-xliff2-translate-no/notranslate-sub-topic.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+ + + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
+
\ No newline at end of file diff --git a/test/create-xliff2-translate-no/notranslate.topic.dita b/test/create-xliff2-translate-no/notranslate.topic.dita new file mode 100644 index 0000000..c598422 --- /dev/null +++ b/test/create-xliff2-translate-no/notranslate.topic.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+
    +
  • + Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +
  • +
  • +

    + To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

    +

    + But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

    +
  • +
+ +
\ No newline at end of file diff --git a/test/create-xliff2-translate-no/test.properties b/test/create-xliff2-translate-no/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/create-xliff2-translate-no/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/create-xliff2-translate-no/topic.dita b/test/create-xliff2-translate-no/topic.dita new file mode 100644 index 0000000..f0e2d96 --- /dev/null +++ b/test/create-xliff2-translate-no/topic.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+
    +
  • + Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +
  • +
  • +

    + To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

    +

    + But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

    +
  • +
+ +
diff --git a/test/create-xliff2-translate-yes/build.xml b/test/create-xliff2-translate-yes/build.xml new file mode 100644 index 0000000..752de43 --- /dev/null +++ b/test/create-xliff2-translate-yes/build.xml @@ -0,0 +1,40 @@ + + + + + + Expect that DITA block elements with translate='yes' are included in XLIFF 2.1 + + + + + + + + + + + + + diff --git a/test/create-xliff2-translate-yes/document.ditamap b/test/create-xliff2-translate-yes/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/create-xliff2-translate-yes/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/create-xliff2-translate-yes/expected.xlf b/test/create-xliff2-translate-yes/expected.xlf new file mode 100644 index 0000000..d2d62dc --- /dev/null +++ b/test/create-xliff2-translate-yes/expected.xlf @@ -0,0 +1,40 @@ + + + + + + + + Cicero + + + + + + <term translate="yes" xml:lang="la"> + </term> + + + The following lines are the origin of + + Lorem Ipsum + : + + + + + + <codeph translate="yes"> + </codeph> + + + Loves or pursues or desires to obtain + + pain of itself + , because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + + + + + diff --git a/test/create-xliff2-translate-yes/test.properties b/test/create-xliff2-translate-yes/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/create-xliff2-translate-yes/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/create-xliff2-translate-yes/topic.dita b/test/create-xliff2-translate-yes/topic.dita new file mode 100644 index 0000000..a4c84f1 --- /dev/null +++ b/test/create-xliff2-translate-yes/topic.dita @@ -0,0 +1,15 @@ + + + + Cicero + +

+ The following lines are the origin of Lorem Ipsum: +

+

+ Loves or pursues or desires to obtain pain of itself, + because it is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+ +
diff --git a/test/create-xliff2-ul-li-p/build.xml b/test/create-xliff2-ul-li-p/build.xml new file mode 100644 index 0000000..c44bead --- /dev/null +++ b/test/create-xliff2-ul-li-p/build.xml @@ -0,0 +1,39 @@ + + + + + + Expect that DITA with a p inside a li can be transformed into an XLIFF 2.0 file + + + + + + + + + + + + diff --git a/test/create-xliff2-ul-li-p/document.ditamap b/test/create-xliff2-ul-li-p/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/create-xliff2-ul-li-p/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/create-xliff2-ul-li-p/expected.xlf b/test/create-xliff2-ul-li-p/expected.xlf new file mode 100644 index 0000000..b0339a2 --- /dev/null +++ b/test/create-xliff2-ul-li-p/expected.xlf @@ -0,0 +1,46 @@ + + + + + + + + Cicero + + + + + + The following lines are the origin of "Lorem Ipsum": + + + + + + <b> + </b> + + + Loves or pursues or desires to obtain + + + + + + + <p> + </p> + <p> + </p> + + + + + + + + + + + + diff --git a/test/create-xliff2-ul-li-p/test.properties b/test/create-xliff2-ul-li-p/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/create-xliff2-ul-li-p/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/create-xliff2-ul-li-p/topic.dita b/test/create-xliff2-ul-li-p/topic.dita new file mode 100644 index 0000000..f27b514 --- /dev/null +++ b/test/create-xliff2-ul-li-p/topic.dita @@ -0,0 +1,28 @@ + + + + Cicero + +

+ The following lines are the origin of "Lorem Ipsum": +

+
    +
  • + Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +
  • +
  • +

    + To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

    +

    + But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

    +
  • +
+ +
diff --git a/test/deepl-response/build.xml b/test/deepl-response/build.xml new file mode 100644 index 0000000..7cfd324 --- /dev/null +++ b/test/deepl-response/build.xml @@ -0,0 +1,25 @@ + + + + + + + Expect that Deepl translations can be read. + + + + + + + + + + + + diff --git a/test/deepl-response/expected.txt b/test/deepl-response/expected.txt new file mode 100644 index 0000000..8095a18 --- /dev/null +++ b/test/deepl-response/expected.txt @@ -0,0 +1 @@ +Hallo, Welt! diff --git a/test/deepl-response/response.json b/test/deepl-response/response.json new file mode 100644 index 0000000..cda2ba3 --- /dev/null +++ b/test/deepl-response/response.json @@ -0,0 +1,6 @@ +{ + "translations": [{ + "detected_source_language":"EN", + "text":"Hallo, Welt!" + }] +} \ No newline at end of file diff --git a/test/deepl-response/result.txt b/test/deepl-response/result.txt new file mode 100644 index 0000000..4863a82 --- /dev/null +++ b/test/deepl-response/result.txt @@ -0,0 +1 @@ +你好, 你叫什么名字? diff --git a/test/order.xsl b/test/order.xsl new file mode 100644 index 0000000..acb5700 --- /dev/null +++ b/test/order.xsl @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/preapproved-cache-xliff1/build.xml b/test/preapproved-cache-xliff1/build.xml new file mode 100644 index 0000000..5a36d5f --- /dev/null +++ b/test/preapproved-cache-xliff1/build.xml @@ -0,0 +1,27 @@ + + + + + + Expect that using a pre-exisiting XLIFF 1.2 cache will pre-populate translations + + + + + + + + + + + + diff --git a/test/preapproved-cache-xliff1/document.ditamap b/test/preapproved-cache-xliff1/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/preapproved-cache-xliff1/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/preapproved-cache-xliff1/expected.xlf b/test/preapproved-cache-xliff1/expected.xlf new file mode 100644 index 0000000..0503a72 --- /dev/null +++ b/test/preapproved-cache-xliff1/expected.xlf @@ -0,0 +1,35 @@ + + + + +
+ + + +
+ + + Cicero + + Cicero + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + +
+
+ diff --git a/test/preapproved-cache-xliff1/test.properties b/test/preapproved-cache-xliff1/test.properties new file mode 100644 index 0000000..1386cc5 --- /dev/null +++ b/test/preapproved-cache-xliff1/test.properties @@ -0,0 +1,2 @@ +translate.cachefile=/Users/jasonfox/Workspace/dita/dita-ot-3.6/plugins/fox.jason.translate.xliff/test/preapproved-cache-xliff1/translate-cache.xlf +xliff.version=1 \ No newline at end of file diff --git a/test/preapproved-cache-xliff1/topic.dita b/test/preapproved-cache-xliff1/topic.dita new file mode 100644 index 0000000..8123b10 --- /dev/null +++ b/test/preapproved-cache-xliff1/topic.dita @@ -0,0 +1,19 @@ + + Cicero + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
\ No newline at end of file diff --git a/test/preapproved-cache-xliff1/translate-cache.xlf b/test/preapproved-cache-xliff1/translate-cache.xlf new file mode 100644 index 0000000..6023d2a --- /dev/null +++ b/test/preapproved-cache-xliff1/translate-cache.xlf @@ -0,0 +1,41 @@ + + + +
+ + + +
+ +
+ +
+ + + +
+ + Cicero + Cicero + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + +
+
diff --git a/test/preapproved-cache-xliff2/build.xml b/test/preapproved-cache-xliff2/build.xml new file mode 100644 index 0000000..c056df4 --- /dev/null +++ b/test/preapproved-cache-xliff2/build.xml @@ -0,0 +1,27 @@ + + + + + + Expect that using a pre-exisiting XLIFF 2.1 cache will pre-populate translations + + + + + + + + + + + + diff --git a/test/preapproved-cache-xliff2/document.ditamap b/test/preapproved-cache-xliff2/document.ditamap new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/preapproved-cache-xliff2/document.ditamap @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/preapproved-cache-xliff2/expected.xlf b/test/preapproved-cache-xliff2/expected.xlf new file mode 100644 index 0000000..193bf36 --- /dev/null +++ b/test/preapproved-cache-xliff2/expected.xlf @@ -0,0 +1,33 @@ + + + + + + + + Cicero + Cicero + + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + + + + diff --git a/test/preapproved-cache-xliff2/test.properties b/test/preapproved-cache-xliff2/test.properties new file mode 100644 index 0000000..e93772c --- /dev/null +++ b/test/preapproved-cache-xliff2/test.properties @@ -0,0 +1,2 @@ +translate.cachefile=/Users/jasonfox/Workspace/dita/dita-ot-3.5/plugins/fox.jason.translate.xliff/test/preapproved-cache-xliff2/translate-cache.xlf +xliff.version=2 \ No newline at end of file diff --git a/test/preapproved-cache-xliff2/topic.dita b/test/preapproved-cache-xliff2/topic.dita new file mode 100644 index 0000000..8123b10 --- /dev/null +++ b/test/preapproved-cache-xliff2/topic.dita @@ -0,0 +1,19 @@ + + Cicero + +

+ Loves or pursues or desires to obtain pain of itself, because it + is pain, but occasionally circumstances occur in which toil and + pain can procure him some great pleasure. +

+

+ To take a trivial example, which of us ever undertakes laborious + physical exercise, except to obtain some advantage from it? +

+

+ But who has any right to find fault with a man who chooses to + enjoy a pleasure that has no annoying consequences, or one who + avoids a pain that produces no resultant pleasure? +

+ +
\ No newline at end of file diff --git a/test/preapproved-cache-xliff2/translate-cache.xlf b/test/preapproved-cache-xliff2/translate-cache.xlf new file mode 100644 index 0000000..5b79401 --- /dev/null +++ b/test/preapproved-cache-xliff2/translate-cache.xlf @@ -0,0 +1,40 @@ + + + + + + + Cicero + Cicero + + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + + + diff --git a/test/watson-response/build.xml b/test/watson-response/build.xml new file mode 100644 index 0000000..5674b86 --- /dev/null +++ b/test/watson-response/build.xml @@ -0,0 +1,26 @@ + + + + + + + Expect that Watson translations can be read. + + + + + + + + + + + + + diff --git a/test/watson-response/expected.txt b/test/watson-response/expected.txt new file mode 100644 index 0000000..a19abfe --- /dev/null +++ b/test/watson-response/expected.txt @@ -0,0 +1 @@ +Hola diff --git a/test/watson-response/response.json b/test/watson-response/response.json new file mode 100644 index 0000000..4b4b649 --- /dev/null +++ b/test/watson-response/response.json @@ -0,0 +1,9 @@ +{ + "translations": [ + { + "translation": "Hola" + } + ], + "word_count": 1, + "character_count": 5 +} \ No newline at end of file diff --git a/test/watson-response/result.txt b/test/watson-response/result.txt new file mode 100644 index 0000000..4863a82 --- /dev/null +++ b/test/watson-response/result.txt @@ -0,0 +1 @@ +你好, 你叫什么名字? diff --git a/test/xliff1-dita-embedded/build.xml b/test/xliff1-dita-embedded/build.xml new file mode 100644 index 0000000..d35a841 --- /dev/null +++ b/test/xliff1-dita-embedded/build.xml @@ -0,0 +1,20 @@ + + + + + + Expect that skeletons + XLIFF 1.0 with embedded elements can be used to create DITA + + + + + + + + diff --git a/test/xliff1-dita-embedded/expected.dita b/test/xliff1-dita-embedded/expected.dita new file mode 100644 index 0000000..0959d92 --- /dev/null +++ b/test/xliff1-dita-embedded/expected.dita @@ -0,0 +1,56 @@ + + + + + Grundnutzung + +

Sie Wird Sie müssen die und prism.css prism.js die Autorendateien , die Sie heruntergeladen haben, auf Ihrer Seite einfügen. beispiel:

+ <!DOCTYPE html> +<html> +<head> + ... + <link href="themes/prism.css" rel="stylesheet" /> + ></head> +<body> + ... + <script src="prism.js"></script> + </body> +</html> +

Prism tut sein Bestes, um bewährte Praktiken zu fördern. Daher funktioniert es nur mit < Code > Elementen, da das Markieren von Code ohne < Code > Element semantisch ungültig ist. Laut der HTML5-Spezifikation ist die language-xxxx empfohlene Methode, eine Code-Sprache zu definieren, eine Klasse, die Prism verwendet. Alternativ unterstützt Prism auch eine kürzere Version: lang-xxxx .

+

Um die Sache zu erleichtern, geht Prism jedoch davon aus, dass diese Sprachdefinition vererbt wird. Wenn also <code> mehrere Elemente die gleiche Sprache haben, können Sie die language-xxxx Klasse auf einem ihrer gemeinsamen Vorfahren hinzufügen. Auf diese Weise können Sie auch eine dokumentweite Standardsprache definieren, indem Sie eine language-xxxx Klasse auf dem <body> oder <html> Element hinzufügen.

+

Wenn Sie sich gegen die <code> Hervorhebung eines Elements entscheiden wollen, das ein Nachkomme eines Elements mit einer deklarierten Code-Sprache ist, können Sie die Klasse language-none dazu hinzufügen (oder eine nicht existierende Sprache, wirklich).

+

Die empfohlene Methode, einen Code-Block zu markieren (sowohl für die Semantik als auch für <pre> die Prisma), ist ein Element mit einem <code> Element im Inneren, wie es so ist:

+ <pre><code class="language-css">p { color: red }</code></pre> +

Wenn Sie dieses Muster verwenden, erhält <pre> der language-xxxx Kurs automatisch die Klasse (wenn sie es nicht bereits hat) und wird als Codeblock gestylt.

+

Wenn Sie verhindern wollen, dass Elemente automatisch hervorgehoben werden, können Sie das Attribut data-manual auf dem <script> Element verwenden, das Sie für Prisma verwendet haben, und die API verwenden. beispiel:

+ <script src="prism.js" data-manual></script> +
+ Einsatz mit Webpack, Browserify, & Andere Bundler +

Wenn Sie Prism mit einem Bundler verwenden wollen, installieren Sie Prism mit npm :

+ $ npm install prismjs +

Sie können dann import in Ihr Bündel einsteigen:

+ import Prism from 'prismjs'; +

Um es einfach zu machen, Ihre Prism-Instanz mit nur den Sprachen und Plugins zu konfigurieren, die Sie benötigen, verwenden Sie das Babel-Plugin, Babel-Plugin-prismjs . Auf diese Weise können Sie die Mindestanzahl an Sprachen und Plugins laden, um Ihre Bedürfnisse zu erfüllen. Sehen Sie sich die Dokumentation des Plugins an, um die Konfigurationsdetails zu erfahren.

+
+
+ Einsatz mit Knoten +

Wenn Sie Prism auf dem Server oder über die Kommandozeile verwenden wollen, kann Prism auch mit Node.js verwendet werden. Dies könnte nützlich sein, wenn Sie versuchen, statische HTML-Seiten mit hervorgehobenem Code für Umgebungen zu generieren, die keine Browser-side-JS unterstützen, wie AMP-Seiten .

+

beispiel:

+ var Prism = require('prismjs'); +// The code snippet you want to highlight, as a string +var code = "var data = 1;"; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.javascript, 'javascript'); +

Wenn prismjs Sie eine Anfrage stellen wollen, werden die markup Standardsprachen: javascript , css clike und geladen. Sie können mehr Sprachen mit dem loadLanguages() Programm laden, das automatisch die erforderlichen Abhängigkeiten bearbeitet.

+

beispiel:

+ var Prism = require('prismjs'); +var loadLanguages = require('prismjs/components/'); +loadLanguages(['haml']); +// The code snippet you want to highlight, as a string +var code = "= ['hi', 'there', 'reader!'].join \" \""; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.haml, 'haml'); +

Hinweis : Verwenden Sie loadLanguages() nicht mit Webpack oder einem anderen Bundler, da dies dazu führt, dass Webpack alle Sprachen und Plugins einschließt. Verwenden Sie das oben beschriebene Babel-Plugin.

+
+ +
diff --git a/test/xliff1-dita-embedded/skl/document.ditamap.skl b/test/xliff1-dita-embedded/skl/document.ditamap.skl new file mode 100644 index 0000000..b74e228 --- /dev/null +++ b/test/xliff1-dita-embedded/skl/document.ditamap.skl @@ -0,0 +1,40 @@ + + + + + + Books about stuff + A book about one thing + + + @@@42094@@@ + Jane + + Example Publishers + Austin, TX + + + + 1977 + + + + + + 1994 + + + 2006 + + + OASIS + + + + + + prismjs + + + + \ No newline at end of file diff --git a/test/xliff1-dita-embedded/skl/topic.dita.skl b/test/xliff1-dita-embedded/skl/topic.dita.skl new file mode 100644 index 0000000..c00128f --- /dev/null +++ b/test/xliff1-dita-embedded/skl/topic.dita.skl @@ -0,0 +1,56 @@ + + + + + @@@59931@@@ + +

@@@60323@@@

+ <!DOCTYPE html> +<html> +<head> + ... + <link href="themes/prism.css" rel="stylesheet" /> + ></head> +<body> + ... + <script src="prism.js"></script> + </body> +</html> +

@@@51849@@@

+

@@@50700@@@

+

@@@46850@@@

+

@@@25020@@@

+ <pre><code class="language-css">p { color: red }</code></pre> +

@@@34362@@@

+

@@@25518@@@

+ <script src="prism.js" data-manual></script> +
+ @@@33578@@@ +

@@@32784@@@

+ $ npm install prismjs +

@@@4035@@@

+ import Prism from 'prismjs'; +

@@@57344@@@

+
+
+ @@@11900@@@ +

@@@5250@@@

+

@@@60425@@@

+ var Prism = require('prismjs'); +// The code snippet you want to highlight, as a string +var code = "var data = 1;"; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.javascript, 'javascript'); +

@@@14934@@@

+

@@@60425@@@

+ var Prism = require('prismjs'); +var loadLanguages = require('prismjs/components/'); +loadLanguages(['haml']); +// The code snippet you want to highlight, as a string +var code = "= ['hi', 'there', 'reader!'].join \" \""; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.haml, 'haml'); +

@@@34183@@@

+
+ +
\ No newline at end of file diff --git a/test/xliff1-dita-embedded/test.properties b/test/xliff1-dita-embedded/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/xliff1-dita-embedded/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/xliff1-dita-embedded/translate.xlf b/test/xliff1-dita-embedded/translate.xlf new file mode 100644 index 0000000..76f5335 --- /dev/null +++ b/test/xliff1-dita-embedded/translate.xlf @@ -0,0 +1,77 @@ + + + +
+ + + +
+ + This is a generic topic that is designed to test sub-topics in a variety of locations. It should always be referenced from a topicref element; specialized elements in this test get their OWN, very special topics. Dies ist ein generisches Thema, das darauf abzielt, Unterthemen an verschiedenen Orten zu testen. Es sollte immer von einem Element des Thrones aus erwähnt werden; Spezielle Elemente in diesem Test erhalten ihre OWN, ganz besondere Themen. + + +
+ +
+ + + +
+ + Basic usage Grundnutzung + + You will need to include the prism.css and prism.js authoring files you downloaded in your page. Example: + Sie Wird Sie müssen die und prism.css prism.js die Autorendateien , die Sie heruntergeladen haben, auf Ihrer Seite einfügen. beispiel: + + + + + Prism does its best to encourage good practices. Therefore, it only works with <code> elements, since marking up code without a <code> element is semantically invalid. According to the HTML5 spec , the recommended way to define a code language is a language-xxxx class, which is what Prism uses. Alternatively, Prism also supports a shorter version: lang-xxxx . Prism tut sein Bestes, um bewährte Praktiken zu fördern. Daher funktioniert es nur mit < Code > Elementen, da das Markieren von Code ohne < Code > Element semantisch ungültig ist. Laut der HTML5-Spezifikation ist die language-xxxx empfohlene Methode, eine Code-Sprache zu definieren, eine Klasse, die Prism verwendet. Alternativ unterstützt Prism auch eine kürzere Version: lang-xxxx . + + To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple <code> elements have the same language, you can add the language-xxxx class on one of their common ancestors. This way, you can also define a document-wide default language, by adding a language-xxxx class on the <body> or <html> element. Um die Sache zu erleichtern, geht Prism jedoch davon aus, dass diese Sprachdefinition vererbt wird. Wenn also <code> mehrere Elemente die gleiche Sprache haben, können Sie die language-xxxx Klasse auf einem ihrer gemeinsamen Vorfahren hinzufügen. Auf diese Weise können Sie auch eine dokumentweite Standardsprache definieren, indem Sie eine language-xxxx Klasse auf dem <body> oder <html> Element hinzufügen. + + If you want to opt-out of highlighting for a <code> element that is a descendant of an element with a declared code language, you can add the class language-none to it (or any non-existing language, really). Wenn Sie sich gegen die <code> Hervorhebung eines Elements entscheiden wollen, das ein Nachkomme eines Elements mit einer deklarierten Code-Sprache ist, können Sie die Klasse language-none dazu hinzufügen (oder eine nicht existierende Sprache, wirklich). + + The recommended way to mark up a code block (both for semantics and for Prism) is a <pre> element with a <code> element inside, like so: Die empfohlene Methode, einen Code-Block zu markieren (sowohl für die Semantik als auch für <pre> die Prisma), ist ein Element mit einem <code> Element im Inneren, wie es so ist: + + If you use that pattern, the <pre> will automatically get the language-xxxx class (if it doesn’t already have it) and will be styled as a code block. Wenn Sie dieses Muster verwenden, erhält <pre> der language-xxxx Kurs automatisch die Klasse (wenn sie es nicht bereits hat) und wird als Codeblock gestylt. + + If you want to prevent any elements from being automatically highlighted, you can use the attribute data-manual on the <script> element you used for prism and use the API . Example: Wenn Sie verhindern wollen, dass Elemente automatisch hervorgehoben werden, können Sie das Attribut data-manual auf dem <script> Element verwenden, das Sie für Prisma verwendet haben, und die API verwenden. beispiel: + + Usage with Webpack, Browserify, & Other Bundlers Einsatz mit Webpack, Browserify, & Andere Bundler + + If you want to use Prism with a bundler, install Prism with npm : Wenn Sie Prism mit einem Bundler verwenden wollen, installieren Sie Prism mit npm : + + You can then import into your bundle: Sie können dann import in Ihr Bündel einsteigen: + + To make it easy to configure your Prism instance with only the languages and plugins you need, use the babel plugin, babel-plugin-prismjs . This will allow you to load the minimum number of languages and plugins to satisfy your needs. See that plugin's documentation for configuration details. Um es einfach zu machen, Ihre Prism-Instanz mit nur den Sprachen und Plugins zu konfigurieren, die Sie benötigen, verwenden Sie das Babel-Plugin, Babel-Plugin-prismjs . Auf diese Weise können Sie die Mindestanzahl an Sprachen und Plugins laden, um Ihre Bedürfnisse zu erfüllen. Sehen Sie sich die Dokumentation des Plugins an, um die Konfigurationsdetails zu erfahren. + + Usage with Node Einsatz mit Knoten + + If you want to use Prism on the server or through the command line, Prism can be used with Node.js as well. This might be useful if you're trying to generate static HTML pages with highlighted code for environments that don't support browser-side JS, like AMP pages . Wenn Sie Prism auf dem Server oder über die Kommandozeile verwenden wollen, kann Prism auch mit Node.js verwendet werden. Dies könnte nützlich sein, wenn Sie versuchen, statische HTML-Seiten mit hervorgehobenem Code für Umgebungen zu generieren, die keine Browser-side-JS unterstützen, wie AMP-Seiten . + + Example: beispiel: + + Requiring prismjs will load the default languages: markup , css , clike and javascript . You can load more languages with the loadLanguages() utility, which will automatically handle any required dependencies. Wenn prismjs Sie eine Anfrage stellen wollen, werden die markup Standardsprachen: javascript , css clike und geladen. Sie können mehr Sprachen mit dem loadLanguages() Programm laden, das automatisch die erforderlichen Abhängigkeiten bearbeitet. + + Example: beispiel: + + Note : Do not use loadLanguages() with Webpack or another bundler, as this will cause Webpack to include all languages and plugins. Use the babel plugin described above. + Hinweis : Verwenden Sie loadLanguages() nicht mit Webpack oder einem anderen Bundler, da dies dazu führt, dass Webpack alle Sprachen und Plugins einschließt. Verwenden Sie das oben beschriebene Babel-Plugin. + + +
+
diff --git a/test/xliff1-dita/build.xml b/test/xliff1-dita/build.xml new file mode 100644 index 0000000..7c045d0 --- /dev/null +++ b/test/xliff1-dita/build.xml @@ -0,0 +1,20 @@ + + + + + + Expect that skeletons + XLIFF 1.2 can be used to create DITA + + + + + + + + diff --git a/test/xliff1-dita/expected.dita b/test/xliff1-dita/expected.dita new file mode 100644 index 0000000..a787223 --- /dev/null +++ b/test/xliff1-dita/expected.dita @@ -0,0 +1,10 @@ + + + + Cicero + +

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+ +
diff --git a/test/xliff1-dita/skl/document.ditamap.skl b/test/xliff1-dita/skl/document.ditamap.skl new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/xliff1-dita/skl/document.ditamap.skl @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/xliff1-dita/skl/topic.dita.skl b/test/xliff1-dita/skl/topic.dita.skl new file mode 100644 index 0000000..a19d1a5 --- /dev/null +++ b/test/xliff1-dita/skl/topic.dita.skl @@ -0,0 +1,10 @@ + + + + @@@46167@@@ + +

@@@54947@@@

+

@@@9962@@@

+

@@@19770@@@

+ +
\ No newline at end of file diff --git a/test/xliff1-dita/test.properties b/test/xliff1-dita/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/xliff1-dita/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/xliff1-dita/translate.xlf b/test/xliff1-dita/translate.xlf new file mode 100644 index 0000000..2b7f565 --- /dev/null +++ b/test/xliff1-dita/translate.xlf @@ -0,0 +1,49 @@ + + + +
+ + + +
+ +
+ +
+ + + +
+ + Cicero Cicero + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat. + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat + cupidatat non proident, sunt in culpa qui officia deserunt mollit + anim id est laborum. + + +
+
diff --git a/test/xliff1-translate/build.xml b/test/xliff1-translate/build.xml new file mode 100644 index 0000000..b43df5d --- /dev/null +++ b/test/xliff1-translate/build.xml @@ -0,0 +1,20 @@ + + + + + + Expect that a translation service can populate unapproved translations for XLIFF 1.2 + + + + + + + + diff --git a/test/xliff1-translate/expected.xlf b/test/xliff1-translate/expected.xlf new file mode 100644 index 0000000..bc8703e --- /dev/null +++ b/test/xliff1-translate/expected.xlf @@ -0,0 +1,31 @@ + + + + +
+ + + +
+ + + Cicero + Cicero + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + +
+
+ diff --git a/test/xliff1-translate/test.properties b/test/xliff1-translate/test.properties new file mode 100644 index 0000000..5103fc5 --- /dev/null +++ b/test/xliff1-translate/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=1 \ No newline at end of file diff --git a/test/xliff1-translate/translate.xlf b/test/xliff1-translate/translate.xlf new file mode 100644 index 0000000..bc8703e --- /dev/null +++ b/test/xliff1-translate/translate.xlf @@ -0,0 +1,31 @@ + + + + +
+ + + +
+ + + Cicero + Cicero + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + +
+
+ diff --git a/test/xliff1-translate/xliff-no-translations.xml b/test/xliff1-translate/xliff-no-translations.xml new file mode 100644 index 0000000..b7169b6 --- /dev/null +++ b/test/xliff1-translate/xliff-no-translations.xml @@ -0,0 +1,42 @@ + + + +
+ + + +
+ +
+ +
+ + + +
+ + Cicero Cicero + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + +
+
diff --git a/test/xliff2-dita-embedded/build.xml b/test/xliff2-dita-embedded/build.xml new file mode 100644 index 0000000..7f4596f --- /dev/null +++ b/test/xliff2-dita-embedded/build.xml @@ -0,0 +1,20 @@ + + + + + + Expect that skeletons + XLIFF 2.1 with embedded elements can be used to create DITA + + + + + + + + diff --git a/test/xliff2-dita-embedded/expected.dita b/test/xliff2-dita-embedded/expected.dita new file mode 100644 index 0000000..1036984 --- /dev/null +++ b/test/xliff2-dita-embedded/expected.dita @@ -0,0 +1,56 @@ + + + + + Grundsätzliche Verwendung + +

@@@60323@@@

+ <!DOCTYPE html> +<html> +<head> + ... + <link href="themes/prism.css" rel="stylesheet" /> + ></head> +<body> + ... + <script src="prism.js"></script> + </body> +</html> +

PRISMA tut sein bestes, um bewährte Praktiken zu fördern. Daher funktioniert es nur mit <code> Elemente, da die Auszeichnung von code ohne <code> element ist semantisch ungültig. Gemäß der HTML5-Spezifikation die empfohlene Art und Weise zu definieren, die eine code-Sprache ist eine Sprache-xxxx Klasse, das ist das, was Prism verwendet. Alternativ PRISMA unterstützt auch eine kürzere version: lang-xxxx .

+

Dinge einfacher zu machen, jedoch PRISMA geht davon aus, dass diese Sprache-definition vererbt wird. Daher, wenn mehrere <code> Elemente haben die gleiche Sprache, können Sie die Sprache-xxxx Klasse auf einem Ihrer gemeinsamen Vorfahren. Auf diese Weise können Sie auch definieren ein Dokument-weiten Standard-Sprache ist, indem Sie ein Sprache-xxxx Klasse auf dem <body> oder <html> element.

+

Wenn Sie wollen opt-out-highlighting für eine <code> element, das ein Nachfahre eines Elements mit einem deklarierten code-Sprache, die Sie hinzufügen können, die Klasse Sprache-keine um es (oder nicht vorhandenen Sprache, wirklich).

+

Die empfohlene Methode zur Markierung einen code-block (sowohl für die Semantik und für PRISMA) ist ein <pre> element mit einem <code> element im inneren, etwa so:

+ <pre><code class="language-css">p { color: red }</code></pre> +

Wenn Sie das Muster, die <pre> erhalten automatisch den Sprache-xxxx Klasse (wenn es nicht bereits haben) und gestylt werden wie ein code-block.

+

Wenn Sie verhindern möchten, dass alle Elemente aus, die automatisch markiert ist, können Sie mithilfe der attribute Daten-Handbuch auf der <script> element, die Sie für prism und verwenden Sie die API . Beispiel:

+ <script src="prism.js" data-manual></script> +
+ Verwendung mit Webpack, Browserify, & Andere Bundlers +

Wenn Sie verwenden möchten PRISMA mit bundler installieren Sie PRISMA mit npm :

+ $ npm install prismjs +

Sie können dann import in Ihr bündeln:

+ import Prism from 'prismjs'; +

Um es einfach zu konfigurieren Sie Ihre Prism-Instanz nur mit den Sprachen und plugins, die Sie benötigen, verwenden Sie den babel-plugin, babel-plugin-prismjs . Dies ermöglicht es Ihnen, laden Sie die minimale Anzahl von Sprachen und plugins, um Ihre Bedürfnisse zu befriedigen. Sehen, dass der plugin-Dokumentation für details zur Konfiguration.

+
+
+ Verwendung mit Knoten +

Wenn Sie möchten, verwenden Sie Prism auf die server oder die über die Befehlszeile, PRISMA kann verwendet werden, mit Node.js wie gut. Dies kann nützlich sein, wenn Sie versuchen, generieren von statischen HTML-Seiten mit hervorgehobenen code für Umgebungen, die keine Unterstützung für browser-side JS, wie AMP Seiten .

+

Beispiel:

+ var Prism = require('prismjs'); +// The code snippet you want to highlight, as a string +var code = "var data = 1;"; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.javascript, 'javascript'); +

Erfordern prismjs lädt die Standard-Sprachen: markup , css , gleich und javascript . Laden Sie weitere Sprachen mit der loadLanguages() Dienstprogramm, das automatisch verarbeitet alle erforderlichen Abhängigkeiten.

+

Beispiel:

+ var Prism = require('prismjs'); +var loadLanguages = require('prismjs/components/'); +loadLanguages(['haml']); +// The code snippet you want to highlight, as a string +var code = "= ['hi', 'there', 'reader!'].join \" \""; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.haml, 'haml'); +

Hinweis : Tun nicht verwenden loadLanguages() mit Webpack oder anderen bundler, da dies dazu führen Webpack alle Sprachen und plugins. Verwenden Sie den babel-plugin wie oben beschrieben.

+
+ +
diff --git a/test/xliff2-dita-embedded/skl/document.ditamap.skl b/test/xliff2-dita-embedded/skl/document.ditamap.skl new file mode 100644 index 0000000..70a3f51 --- /dev/null +++ b/test/xliff2-dita-embedded/skl/document.ditamap.skl @@ -0,0 +1,54 @@ + + + + @@@8585@@@ + + + + + + + + + + + @@@12043@@@ + + + + + + + \ No newline at end of file diff --git a/test/xliff2-dita-embedded/skl/topic.dita.skl b/test/xliff2-dita-embedded/skl/topic.dita.skl new file mode 100644 index 0000000..c00128f --- /dev/null +++ b/test/xliff2-dita-embedded/skl/topic.dita.skl @@ -0,0 +1,56 @@ + + + + + @@@59931@@@ + +

@@@60323@@@

+ <!DOCTYPE html> +<html> +<head> + ... + <link href="themes/prism.css" rel="stylesheet" /> + ></head> +<body> + ... + <script src="prism.js"></script> + </body> +</html> +

@@@51849@@@

+

@@@50700@@@

+

@@@46850@@@

+

@@@25020@@@

+ <pre><code class="language-css">p { color: red }</code></pre> +

@@@34362@@@

+

@@@25518@@@

+ <script src="prism.js" data-manual></script> +
+ @@@33578@@@ +

@@@32784@@@

+ $ npm install prismjs +

@@@4035@@@

+ import Prism from 'prismjs'; +

@@@57344@@@

+
+
+ @@@11900@@@ +

@@@5250@@@

+

@@@60425@@@

+ var Prism = require('prismjs'); +// The code snippet you want to highlight, as a string +var code = "var data = 1;"; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.javascript, 'javascript'); +

@@@14934@@@

+

@@@60425@@@

+ var Prism = require('prismjs'); +var loadLanguages = require('prismjs/components/'); +loadLanguages(['haml']); +// The code snippet you want to highlight, as a string +var code = "= ['hi', 'there', 'reader!'].join \" \""; +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.haml, 'haml'); +

@@@34183@@@

+
+ +
\ No newline at end of file diff --git a/test/xliff2-dita-embedded/test.properties b/test/xliff2-dita-embedded/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/xliff2-dita-embedded/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/xliff2-dita-embedded/translate.xlf b/test/xliff2-dita-embedded/translate.xlf new file mode 100644 index 0000000..ba67bbf --- /dev/null +++ b/test/xliff2-dita-embedded/translate.xlf @@ -0,0 +1,467 @@ + + + + + + + Prism JS Plug-in + PRISMA JS-Plug-in + + + + + + prismjs + prismjs + + + + + + + + + Basic usage + Grundsätzliche Verwendung + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + <ph xml:lang="de"> + </ph> + + + You need to include the prism.css and prism.jsauthoring files you downloaded in your page. Example: + Sie müssen die + prism.css + und + prism.js + + + authoring + Dateien, die Sie heruntergeladen haben, in Ihre Seite aufnehmen. Beispiel: + + + + + + <b> + </b> + <i> + </i> + <xref format="html" scope="external" href="https://www.w3.org/TR/html52/textlevel-semantics.html#the-code-element"> + </xref> + <codeph> + </codeph> + <codeph> + </codeph> + + + Prism does its best to encourage good practices. Therefore, it only works with <code>elements, since marking up code without a <code> element is semantically invalid. According to the HTML5 spec, the recommended way to define a code language is a language-xxxxclass, which is what Prism uses. Alternatively, Prism also supports a shorter version: lang-xxxx. + PRISMA tut sein bestes, um bewährte Praktiken zu fördern. Daher funktioniert es nur mit + <code> + Elemente, da die Auszeichnung von code ohne + <code> + element ist semantisch ungültig. + Gemäß der HTML5-Spezifikation + die empfohlene Art und Weise zu definieren, die eine code-Sprache ist eine + Sprache-xxxx + Klasse, das ist das, was Prism verwendet. Alternativ PRISMA unterstützt auch eine kürzere version: + lang-xxxx + . + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + + + To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple <code> elements have the same language, you can add the language-xxxx class on one of their common ancestors. This way, you can also define a document-wide default language, by adding a language-xxxx class on the <body>or <html> element. + Dinge einfacher zu machen, jedoch PRISMA geht davon aus, dass diese Sprache-definition vererbt wird. Daher, wenn mehrere + <code> + Elemente haben die gleiche Sprache, können Sie die + Sprache-xxxx + Klasse auf einem Ihrer gemeinsamen Vorfahren. Auf diese Weise können Sie auch definieren ein Dokument-weiten Standard-Sprache ist, indem Sie ein + Sprache-xxxx + Klasse auf dem + <body> + oder + <html> + element. + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + + + If you want to opt-out of highlighting for a <code>element that is a descendant of an element with a declared code language, you can add the class language-none to it (or any non-existing language, really). + Wenn Sie wollen opt-out-highlighting für eine + <code> + element, das ein Nachfahre eines Elements mit einem deklarierten code-Sprache, die Sie hinzufügen können, die Klasse + Sprache-keine + um es (oder nicht vorhandenen Sprache, wirklich). + + + + + + <xref format="html" scope="external" href="https://www.w3.org/TR/html5/grouping-content.html#the-pre-element"> + </xref> + <codeph> + </codeph> + <codeph> + </codeph> + + + The recommended way to mark up a code block (both for semantics and for Prism) is a <pre>element with a <code> element inside, like so: + Die + empfohlene Methode zur Markierung einen code-block + (sowohl für die Semantik und für PRISMA) ist ein + <pre> + element mit einem + <code> + element im inneren, etwa so: + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + + + If you use that pattern, the <pre> will automatically get the language-xxxx class (if it doesn’t already have it) and will be styled as a code block. + Wenn Sie das Muster, die + <pre> + erhalten automatisch den + Sprache-xxxx + Klasse (wenn es nicht bereits haben) und gestylt werden wie ein code-block. + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + <xref format="html" scope="external" href="https://prismjs.com/extending.html#api"> + </xref> + + + If you want to prevent any elements from being automatically highlighted, you can use the attribute data-manual on the <script>element you used for prism and use the API. Example: + Wenn Sie verhindern möchten, dass alle Elemente aus, die automatisch markiert ist, können Sie mithilfe der attribute + Daten-Handbuch + auf der + <script> + element, die Sie für prism und verwenden Sie die + API + . Beispiel: + + + + + + Usage with Webpack, Browserify, & Other Bundlers + Verwendung mit Webpack, Browserify, & Andere Bundlers + + + + + + <codeph> + </codeph> + + + If you want to use Prism with a bundler, install Prism with npm: + Wenn Sie verwenden möchten PRISMA mit bundler installieren Sie PRISMA mit + npm + : + + + + + + <codeph outputclass="language-js"> + </codeph> + + + You can then import into your bundle: + Sie können dann + import + in Ihr bündeln: + + + + + + <xref format="html" scope="external" href="https://github.com/mAAdhaTTah/babel-plugin-prismjs"> + </xref> + + + To make it easy to configure your Prism instance with only the languages and plugins you need, use the babel plugin, babel-plugin-prismjs. This will allow you to load the minimum number of languages and plugins to satisfy your needs. See that plugin's documentation for configuration details. + Um es einfach zu konfigurieren Sie Ihre Prism-Instanz nur mit den Sprachen und plugins, die Sie benötigen, verwenden Sie den babel-plugin, + babel-plugin-prismjs + . Dies ermöglicht es Ihnen, laden Sie die minimale Anzahl von Sprachen und plugins, um Ihre Bedürfnisse zu befriedigen. Sehen, dass der plugin-Dokumentation für details zur Konfiguration. + + + + + + Usage with Node + Verwendung mit Knoten + + + + + + <xref format="html" scope="external" href="https://www.ampproject.org/"> + </xref> + + + If you want to use Prism on the server or through the command line, Prism can be used with Node.js as well. This might be useful if you're trying to generate static HTML pages with highlighted code for environments that don't support browser-side JS, like AMP pages. + Wenn Sie möchten, verwenden Sie Prism auf die server oder die über die Befehlszeile, PRISMA kann verwendet werden, mit Node.js wie gut. Dies kann nützlich sein, wenn Sie versuchen, generieren von statischen HTML-Seiten mit hervorgehobenen code für Umgebungen, die keine Unterstützung für browser-side JS, wie + AMP Seiten + . + + + + + + Example: + Beispiel: + + + + + + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + <codeph> + </codeph> + <codeph outputclass="language-javascript"> + </codeph> + + + Requiring prismjs will load the default languages: markup, css, clike and javascript. You can load more languages with the loadLanguages()utility, which will automatically handle any required dependencies. + Erfordern + prismjs + lädt die Standard-Sprachen: + markup + , + css + , + gleich + und + javascript + . Laden Sie weitere Sprachen mit der + loadLanguages() + Dienstprogramm, das automatisch verarbeitet alle erforderlichen Abhängigkeiten. + + + + + + Example: + Beispiel: + + + + + + <b> + </b> + <i> + </i> + <codeph outputclass="language-javascript"> + </codeph> + + + Note: Do not use loadLanguages()with Webpack or another bundler, as this will cause Webpack to include all languages and plugins. Use the babel plugin described above. + + + Hinweis + : Tun + nicht + verwenden + loadLanguages() + mit Webpack oder anderen bundler, da dies dazu führen Webpack alle Sprachen und plugins. Verwenden Sie den babel-plugin wie oben beschrieben. + + + + + diff --git a/test/xliff2-dita/build.xml b/test/xliff2-dita/build.xml new file mode 100644 index 0000000..2746dd1 --- /dev/null +++ b/test/xliff2-dita/build.xml @@ -0,0 +1,20 @@ + + + + + + Expect that skeletons + XLIFF 2.0 can be used to create DITA + + + + + + + + diff --git a/test/xliff2-dita/expected.dita b/test/xliff2-dita/expected.dita new file mode 100644 index 0000000..a787223 --- /dev/null +++ b/test/xliff2-dita/expected.dita @@ -0,0 +1,10 @@ + + + + Cicero + +

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+ +
diff --git a/test/xliff2-dita/skl/document.ditamap.skl b/test/xliff2-dita/skl/document.ditamap.skl new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/test/xliff2-dita/skl/document.ditamap.skl @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/xliff2-dita/skl/topic.dita.skl b/test/xliff2-dita/skl/topic.dita.skl new file mode 100644 index 0000000..a19d1a5 --- /dev/null +++ b/test/xliff2-dita/skl/topic.dita.skl @@ -0,0 +1,10 @@ + + + + @@@46167@@@ + +

@@@54947@@@

+

@@@9962@@@

+

@@@19770@@@

+ +
\ No newline at end of file diff --git a/test/xliff2-dita/test.properties b/test/xliff2-dita/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/xliff2-dita/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/xliff2-dita/translate.xlf b/test/xliff2-dita/translate.xlf new file mode 100644 index 0000000..7148bdb --- /dev/null +++ b/test/xliff2-dita/translate.xlf @@ -0,0 +1,41 @@ + + + + + + + Cicero + Cicero + + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + + + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + + + + + diff --git a/test/xliff2-translate/build.xml b/test/xliff2-translate/build.xml new file mode 100644 index 0000000..1d27973 --- /dev/null +++ b/test/xliff2-translate/build.xml @@ -0,0 +1,20 @@ + + + + + + Expect that a translation service can populate unapproved translations for XLIFF 2.1 + + + + + + + + diff --git a/test/xliff2-translate/expected.xlf b/test/xliff2-translate/expected.xlf new file mode 100644 index 0000000..6c6c2ea --- /dev/null +++ b/test/xliff2-translate/expected.xlf @@ -0,0 +1,26 @@ + + + + + + Cicero + Cicero + + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + diff --git a/test/xliff2-translate/test.properties b/test/xliff2-translate/test.properties new file mode 100644 index 0000000..6cacfe6 --- /dev/null +++ b/test/xliff2-translate/test.properties @@ -0,0 +1,2 @@ +translate.service=dummy +xliff.version=2 \ No newline at end of file diff --git a/test/xliff2-translate/translate.xlf b/test/xliff2-translate/translate.xlf new file mode 100644 index 0000000..6c6c2ea --- /dev/null +++ b/test/xliff2-translate/translate.xlf @@ -0,0 +1,26 @@ + + + + + + Cicero + Cicero + + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + diff --git a/test/xliff2-translate/xliff-no-translations.xml b/test/xliff2-translate/xliff-no-translations.xml new file mode 100644 index 0000000..5b79401 --- /dev/null +++ b/test/xliff2-translate/xliff-no-translations.xml @@ -0,0 +1,40 @@ + + + + + + + Cicero + Cicero + + + + + Loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + + To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? + + + + + + But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? + + + + + diff --git a/test/yandex-response/build.xml b/test/yandex-response/build.xml new file mode 100644 index 0000000..0ee9fe7 --- /dev/null +++ b/test/yandex-response/build.xml @@ -0,0 +1,25 @@ + + + + + + + Expect that Yandex translations can be read. + + + + + + + + + + + + diff --git a/test/yandex-response/expected.txt b/test/yandex-response/expected.txt new file mode 100644 index 0000000..f308173 --- /dev/null +++ b/test/yandex-response/expected.txt @@ -0,0 +1 @@ +Autolink URLs und E-Mails, verwenden Markdown-links in Kommentaren (erfordert plugin ) diff --git a/test/yandex-response/response.json b/test/yandex-response/response.json new file mode 100644 index 0000000..0b27cb8 --- /dev/null +++ b/test/yandex-response/response.json @@ -0,0 +1,7 @@ +{ + "code": 200, + "lang": "en-de", + "text": [ + "Autolink URLs und E-Mails, verwenden Markdown-links in Kommentaren (erfordert plugin ) " + ] +} \ No newline at end of file diff --git a/test/yandex-response/result.txt b/test/yandex-response/result.txt new file mode 100644 index 0000000..4863a82 --- /dev/null +++ b/test/yandex-response/result.txt @@ -0,0 +1 @@ +你好, 你叫什么名字?