Skip to content

Commit

Permalink
Add glossgroup and troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Jan 17, 2024
1 parent f29e97a commit dabc739
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 51 deletions.
Binary file removed lib/translate-1.2.jar
Binary file not shown.
Binary file added lib/translate-1.3.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-->
<plugin id="fox.jason.translate.xliff" version="4.0.0">

<feature extension="dita.conductor.lib.import" file="lib/translate-1.2.jar"/>
<feature extension="dita.conductor.lib.import" file="lib/translate-1.3.jar"/>
<feature
extension="dita.conductor.lib.import"
file="lib/json-simple-1.1.1.jar"
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fox.jason</groupId>
<artifactId>translate</artifactId>
<version>1.2</version>
<version>1.3</version>

<dependencies>
<dependency>
Expand Down
8 changes: 8 additions & 0 deletions src/fox/jason/translate/tasks/ReinsertDoctypeTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ private String getDoctype(String doctype) {
type =
"PUBLIC \"-//OASIS//DTD DITA Glossary Entry//EN\" \"glossentry.dtd\"";
break;
case "glossgroup":
type =
"PUBLIC \"-//OASIS//DTD DITA Glossary Group//EN\" \"glossgroup.dtd\"";
break;
case "glossary":
type = "PUBLIC \"-//OASIS//DTD DITA Glossary//EN\" \"glossary.dtd\"";
break;
Expand Down Expand Up @@ -122,6 +126,10 @@ private String getDoctype(String doctype) {
case "ditaval":
type = "PUBLIC \"-//OASIS//DTD DITA DITAVAL//EN\" \"ditaval.dtd\"";
break;
case "troubleshooting":
type =
"PUBLIC \"-//OASIS//DTD DITA Troubleshooting//EN\" \"troubleshooting.dtd\"";
break;
default:
getProject().log("Unknown Doctype: " + doctype, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion test/bootstrap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<taskdef resource="fox/jason/translate/antlib.xml">
<classpath>
<pathelement
location="${dita.dir}/plugins/fox.jason.translate.xliff/lib/translate-1.2.jar"
location="${dita.dir}/plugins/fox.jason.translate.xliff/lib/translate-1.3.jar"
/>
<pathelement
location="${dita.dir}/plugins/fox.jason.translate.xliff/lib/json-simple-1.1.1.jar"
Expand Down
10 changes: 5 additions & 5 deletions test/create-xliff1-embedded/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<exec-transtype transtype="xliff-create"/>
<order-xliff file="${basedir}/out/translate.xlf"/>
<replaceregexp
file="${basedir}/out/translate.xlf"
flags="gi"
match="id=\&quot;.*\&quot; translate"
replace="id=&quot;&quot; translate"
/>
file="${basedir}/out/translate.xlf"
flags="gi"
match="id=\&quot;.*\&quot;"
replace="id=&quot;&quot;"
/>
<compare-output
expectation="${basedir}/expected.xlf"
result="${basedir}/out/translate.xlf"
Expand Down
74 changes: 37 additions & 37 deletions test/create-xliff1-embedded/expected.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,77 @@
</skl>
</header>
<body xmlns="urn:oasis:names:tc:xliff:document:1.2">
<trans-unit approved="no" id="59931" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">Basic usage</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="15534" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">You will need to include the
<x ctype="x-dita-codeph" id="" translate="no">prism.css</x>and
<x ctype="x-dita-codeph" id="" translate="no">prism.js</x>files you downloaded in your page. Example:</source>
<x ctype="x-dita-codeph" id="">prism.css</x>and
<x ctype="x-dita-codeph" id="">prism.js</x>files you downloaded in your page. Example:</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="57886" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">Prism does its best to encourage good authoring practices. Therefore,it only works with
<x ctype="x-dita-codeph" id="" translate="no">&lt;code&gt;</x>elements, since marking upcode without a
<x ctype="x-dita-codeph" id="" translate="no">&lt;code&gt;</x>element is semantically invalid.
<x ctype="x-dita-xref" dita:format="html" dita:href="https://www.w3.org/TR/html52/textlevel-semantics.html#the-code-element" dita:scope="external" id="d4e25" xmlns:dita="dita-ot.org">According to the HTML5 spec</x>, the recommended way to define a code language is a
<x ctype="x-dita-codeph" id="" translate="no">language-xxxx</x>class, which is what Prism uses. Alternatively, Prism also supports a shorter version:
<x ctype="x-dita-codeph" id="" translate="no">lang-xxxx</x>.</source>
<x ctype="x-dita-codeph" id="">&lt;code&gt;</x>elements, since marking upcode without a
<x ctype="x-dita-codeph" id="">&lt;code&gt;</x>element is semantically invalid.
<x ctype="x-dita-xref" dita:format="html" dita:href="https://www.w3.org/TR/html52/textlevel-semantics.html#the-code-element" dita:scope="external" id="">According to the HTML5 spec</x>, the recommended way to define a code language is a
<x ctype="x-dita-codeph" id="">language-xxxx</x>class, which is what Prism uses. Alternatively, Prism also supports a shorter version:
<x ctype="x-dita-codeph" id="">lang-xxxx</x>.</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="50700" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple
<x ctype="x-dita-codeph" id="" translate="no">&lt;code&gt;</x>elements have the same language, you can add the
<x ctype="x-dita-codeph" id="" translate="no">language-xxxx</x>class on one of their common ancestors. This way, you can also define a document-wide default language, by adding a
<x ctype="x-dita-codeph" id="" translate="no">language-xxxx</x>class on the
<x ctype="x-dita-codeph" id="" translate="no">&lt;body&gt;</x>or
<x ctype="x-dita-codeph" id="" translate="no">&lt;html&gt;</x>element.</source>
<x ctype="x-dita-codeph" id="">&lt;code&gt;</x>elements have the same language, you can add the
<x ctype="x-dita-codeph" id="">language-xxxx</x>class on one of their common ancestors. This way, you can also define a document-wide default language, by adding a
<x ctype="x-dita-codeph" id="">language-xxxx</x>class on the
<x ctype="x-dita-codeph" id="">&lt;body&gt;</x>or
<x ctype="x-dita-codeph" id="">&lt;html&gt;</x>element.</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="46850" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">If you want to opt-out of highlighting for a
<x ctype="x-dita-codeph" id="" translate="no">&lt;code&gt;</x>element that is a descendant of an element with a declared code language, you can add the class
<x ctype="x-dita-codeph" id="" translate="no">language-none</x>to it (or any non-existing language, really).</source>
<x ctype="x-dita-codeph" id="">&lt;code&gt;</x>element that is a descendant of an element with a declared code language, you can add the class
<x ctype="x-dita-codeph" id="">language-none</x>to it (or any non-existing language, really).</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="25020" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">The
<x ctype="x-dita-xref" dita:format="html" dita:href="https://www.w3.org/TR/html5/grouping-content.html#the-pre-element" dita:scope="external" id="d4e59" xmlns:dita="dita-ot.org">recommended way to mark up a code block</x>(both for semantics and for Prism) is a
<x ctype="x-dita-codeph" id="" translate="no">&lt;pre&gt;</x>element with a
<x ctype="x-dita-codeph" id="" translate="no">&lt;code&gt;</x>element inside, like so:</source>
<x ctype="x-dita-xref" dita:format="html" dita:href="https://www.w3.org/TR/html5/grouping-content.html#the-pre-element" dita:scope="external" id="">recommended way to mark up a code block</x>(both for semantics and for Prism) is a
<x ctype="x-dita-codeph" id="">&lt;pre&gt;</x>element with a
<x ctype="x-dita-codeph" id="">&lt;code&gt;</x>element inside, like so:</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="34362" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">If you use that pattern, the
<x ctype="x-dita-codeph" id="" translate="no">&lt;pre&gt;</x>will automatically get the
<x ctype="x-dita-codeph" id="" translate="no">language-xxxx</x>class (if it doesn&#8217;t already have it) and will be styled as a code block.</source>
<x ctype="x-dita-codeph" id="">&lt;pre&gt;</x>will automatically get the
<x ctype="x-dita-codeph" id="">language-xxxx</x>class (if it doesn&#8217;t already have it) and will be styled as a code block.</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="25518" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">If you want to prevent any elements from being automatically highlighted, you can use the attribute
<x ctype="x-dita-codeph" id="" translate="no">data-manual</x>on the
<x ctype="x-dita-codeph" id="" translate="no">&lt;script&gt;</x>element you used for prism and use the
<x ctype="x-dita-xref" dita:format="html" dita:href="https://prismjs.com/extending.html#api" dita:scope="external" id="d4e84" xmlns:dita="dita-ot.org">API</x>. Example:</source>
<x ctype="x-dita-codeph" id="">data-manual</x>on the
<x ctype="x-dita-codeph" id="">&lt;script&gt;</x>element you used for prism and use the
<x ctype="x-dita-xref" dita:format="html" dita:href="https://prismjs.com/extending.html#api" dita:scope="external" id="">API</x>. Example:</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="33578" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">Usage with Webpack, Browserify, &amp; Other Bundlers</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="32784" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">If you want to use Prism with a bundler, install Prism with
<x ctype="x-dita-codeph" id="" translate="no">npm</x>:</source>
<x ctype="x-dita-codeph" id="">npm</x>:</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="19337" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">You can then
<x ctype="x-dita-codeph" dita:outputclass="language-js" id="" translate="no" xmlns:dita="dita-ot.org">import</x>into your bundle</source>
<x ctype="x-dita-codeph" dita:outputclass="language-js" id="">import</x>into your bundle</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="10929" xml:space="preserve">
<trans-unit approved="no" id="">
<source xml:lang="en">To make it easy to configure your Prism instance with only thelanguages and plugins you need, use the babel plugin,
<x ctype="x-dita-xref" dita:format="html" dita:href="https://github.com/mAAdhaTTah/babel-plugin-prismjs" dita:scope="external" id="d4e115" xmlns:dita="dita-ot.org">babel-plugin-prismjs</x>. 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</source>
<x ctype="x-dita-xref" dita:format="html" dita:href="https://github.com/mAAdhaTTah/babel-plugin-prismjs" dita:scope="external" id="">babel-plugin-prismjs</x>. 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</source>
<target xml:lang="de"></target>
</trans-unit>
</body>
Expand Down
7 changes: 7 additions & 0 deletions test/create-xliff1-glossentry/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
<delete dir="${basedir}/out" failonerror="false"/>
<delete dir="${basedir}/temp" failonerror="false"/>
<exec-transtype transtype="xliff-create"/>

<order-xliff file="${basedir}/out/translate.xlf"/>
<replaceregexp
file="${basedir}/out/translate.xlf"
flags="gi"
match="id=\&quot;.*\&quot; translate"
replace="id=&quot;&quot; translate"
/>
<compare-output
expectation="${basedir}/expected.xlf"
result="${basedir}/out/translate.xlf"
Expand Down
2 changes: 1 addition & 1 deletion test/create-xliff1-glossentry/expected.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</trans-unit>
<trans-unit approved="no" id="29470" xml:space="preserve">
<source xml:lang="en">
<x ctype="x-dita-term" id="d4e7" translate="no">Mnemonics</x>are keywords by which each of the instrument's subsystems is referred to.</source>
<x ctype="x-dita-term" id="" translate="no">Mnemonics</x>are keywords by which each of the instrument's subsystems is referred to.</source>
<target xml:lang="de"></target>
</trans-unit>
</body>
Expand Down
7 changes: 7 additions & 0 deletions test/create-xliff1-translate-no/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
replace=""
/>

<replaceregexp
file="${basedir}/out/translate2.xlf"
flags="gi"
match="id=\&quot;.*\&quot; translate"
replace="id=&quot;&quot; translate"
/>

<compare-output
expectation="${basedir}/expected.xlf"
result="${basedir}/out/translate2.xlf"
Expand Down
6 changes: 3 additions & 3 deletions test/create-xliff1-translate-no/expected.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</trans-unit>
<trans-unit approved="no" id="10044" xml:space="preserve">
<source xml:lang="en">The following lines are the origin of
<x ctype="x-dita-term" id="d6e11" translate="no">Lorem Ipsum</x>:</source>
<x ctype="x-dita-term" id="" translate="no">Lorem Ipsum</x>:</source>
<target xml:lang="de"></target>
</trans-unit>
</body>
Expand All @@ -53,12 +53,12 @@
</trans-unit>
<trans-unit approved="no" id="10044" xml:space="preserve">
<source xml:lang="en">The following lines are the origin of
<x ctype="x-dita-term" id="d8e11" translate="no" xml:lang="la">Lorem Ipsum</x>:</source>
<x ctype="x-dita-term" id="" translate="no" xml:lang="la">Lorem Ipsum</x>:</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="54947" xml:space="preserve">
<source xml:lang="en">Loves or pursues or desires to obtain
<x ctype="x-dita-codeph" id="d8e20" translate="no">pain of itself</x>, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.</source>
<x ctype="x-dita-codeph" id="" translate="no">pain of itself</x>, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="2885" xml:space="preserve">
Expand Down
7 changes: 7 additions & 0 deletions test/create-xliff1-translate-yes/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
match="&lt;pc.*&gt;"
replace="&lt;pc&gt;"
/>

<replaceregexp
file="${basedir}/out/translate.xlf"
flags="gi"
match="id=\&quot;.*\&quot; translate"
replace="id=&quot;&quot; translate"
/>
<compare-output
expectation="${basedir}/expected.xlf"
result="${basedir}/out/translate.xlf"
Expand Down
4 changes: 2 additions & 2 deletions test/create-xliff1-translate-yes/expected.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
</trans-unit>
<trans-unit approved="no" id="10044" xml:space="preserve">
<source xml:lang="en">The following lines are the origin of
<x ctype="x-dita-term" id="d4e11" translate="yes" xml:lang="la">Lorem Ipsum</x>:</source>
<x ctype="x-dita-term" id="" translate="yes" xml:lang="la">Lorem Ipsum</x>:</source>
<target xml:lang="de"></target>
</trans-unit>
<trans-unit approved="no" id="54947" xml:space="preserve">
<source xml:lang="en">Loves or pursues or desires to obtain
<x ctype="x-dita-codeph" id="d4e18" translate="yes">pain of itself</x>, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.</source>
<x ctype="x-dita-codeph" id="" translate="yes">pain of itself</x>, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.</source>
<target xml:lang="de"></target>
</trans-unit>
</body>
Expand Down

0 comments on commit dabc739

Please sign in to comment.