You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/09/25 14:29:31 UTC
svn commit: r1705283 - in /sis:
branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/
site/trunk/book/fr/ site/trunk/content/book/fr/
Author: desruisseaux
Date: Fri Sep 25 12:29:31 2015
New Revision: 1705283
URL: http://svn.apache.org/viewvc?rev=1705283&view=rev
Log:
Localization.
Added:
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources.java (with props)
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_en.java (with props)
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_fr.java (with props)
Modified:
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
sis/site/trunk/book/fr/body.html
sis/site/trunk/content/book/fr/developer-guide.html
Modified: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java?rev=1705283&r1=1705282&r2=1705283&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java [UTF-8] Fri Sep 25 12:29:31 2015
@@ -19,7 +19,9 @@ package org.apache.sis.internal.book;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Map;
+import java.util.ResourceBundle;
import java.util.Set;
import java.io.File;
import java.io.IOException;
@@ -114,14 +116,21 @@ public final class Assembler {
private Element previousChapter;
/**
+ * Localized resources.
+ */
+ private final ResourceBundle resources;
+
+ /**
* Creates a new assembler for the given input and output files.
*
- * @param input the input file (e.g. {@code "site/book/en/body.html"}).
+ * @param input the input file (e.g. {@code "site/book/en/body.html"}).
+ * @param locale the locale for the message to generates in HTML code.
* @throws ParserConfigurationException if this constructor can not build the XML document.
* @throws IOException if an error occurred while reading the file.
* @throws SAXException if an error occurred while parsing the XML.
*/
- public Assembler(final File input) throws ParserConfigurationException, IOException, SAXException {
+ public Assembler(final File input, final Locale locale) throws ParserConfigurationException, IOException, SAXException {
+ resources = ResourceBundle.getBundle("org.apache.sis.internal.book.Resources", locale);
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// No setXIncludeAware(true) - we will handle <xi:include> elements ourself.
factory.setNamespaceAware(true);
@@ -308,7 +317,7 @@ public final class Assembler {
tableOfChapterContent = document.createElement("ul");
tableOfChapterContent.setAttribute("class", "toc");
final Node nav = document.createElement("nav");
- nav.appendChild(document.createTextNode("In this chapter:"));
+ nav.appendChild(document.createTextNode(resources.getString("this-chapter")));
nav.appendChild(tableOfChapterContent);
Node insertionPoint = node.getParentNode(); // The <header> element.
do insertionPoint = insertionPoint.getNextSibling(); // The first paragraph.
@@ -401,7 +410,7 @@ public final class Assembler {
final Element previous = document.createElement("div");
previous.setAttribute("class", "previous-chapter");
previous.appendChild(document.createTextNode("⬅ "));
- previous.appendChild(createLink(previousChapter.getAttribute("id"), "Previous chapter"));
+ previous.appendChild(createLink(previousChapter.getAttribute("id"), resources.getString("previous-chapter")));
links.appendChild(previous);
/*
* Update the previous <h1> element with the link to the next chapter,
@@ -411,7 +420,7 @@ public final class Assembler {
*/
final Element next = document.createElement("div");
next.setAttribute("class", "next-chapter");
- next.appendChild(createLink(head.getAttribute("id"), "Next chapter"));
+ next.appendChild(createLink(head.getAttribute("id"), resources.getString("next-chapter")));
next.appendChild(document.createTextNode(" ➡"));
Node previousNav = previousChapter;
Added: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources.java?rev=1705283&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources.java (added)
+++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources.java [UTF-8] Fri Sep 25 12:29:31 2015
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.book;
+
+import java.util.ListResourceBundle;
+
+
+/**
+ * Localized resources, for internal usage only.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.7
+ * @version 0.7
+ */
+public class Resources extends ListResourceBundle {
+ @Override
+ protected Object[][] getContents() {
+ return new Object[][] {
+ new Object[] {"previous-chapter", "Previous chapter"},
+ new Object[] {"next-chapter", "Next chapter"},
+ new Object[] {"this-chapter", "In this chapter:"}
+ };
+ }
+}
Propchange: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_en.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_en.java?rev=1705283&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_en.java (added)
+++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_en.java [UTF-8] Fri Sep 25 12:29:31 2015
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.book;
+
+
+/**
+ * Localized resources, for internal usage only.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.7
+ * @version 0.7
+ */
+public final class Resources_en extends Resources {
+}
Propchange: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_en.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_en.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_fr.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_fr.java?rev=1705283&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_fr.java (added)
+++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_fr.java [UTF-8] Fri Sep 25 12:29:31 2015
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.book;
+
+
+/**
+ * Localized resources, for internal usage only.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.7
+ * @version 0.7
+ */
+public final class Resources_fr extends Resources {
+ @Override
+ protected Object[][] getContents() {
+ final Object[][] resources = super.getContents();
+ resources[0][1] = "Chapitre suivant";
+ resources[1][1] = "Chapitre précédent";
+ resources[2][1] = "Dans ce chapitre:";
+ return resources;
+ }
+}
Propchange: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_fr.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Resources_fr.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified: sis/site/trunk/book/fr/body.html
URL: http://svn.apache.org/viewvc/sis/site/trunk/book/fr/body.html?rev=1705283&r1=1705282&r2=1705283&view=diff
==============================================================================
--- sis/site/trunk/book/fr/body.html (original)
+++ sis/site/trunk/book/fr/body.html Fri Sep 25 12:29:31 2015
@@ -29,8 +29,8 @@
<link rel="stylesheet" type="text/css" href="../book.css"/>
</head>
<body>
- <p style="margin-top: 30pt"><span style="font-size: 30pt; font-weight: 900">Introduction to Apache SIS®</span></p>
- <p style="margin-bottom: 20pt">(English | <a href="../fr/developer-guide.html">Français</a>)</p>
+ <p style="margin-top: 30pt"><span style="font-size: 30pt; font-weight: 900">Introduction à Apache SIS®</span></p>
+ <p style="margin-bottom: 20pt">(<a href="../en/developer-guide.html">English</a> | Français)</p>
<p><i>Martin Desruisseaux</i><br/>
<i>Christina Hough</i> (pour la traduction anglaise)</p>
<p>Ce document est distribué sous licence Apache 2.</p>
Modified: sis/site/trunk/content/book/fr/developer-guide.html
URL: http://svn.apache.org/viewvc/sis/site/trunk/content/book/fr/developer-guide.html?rev=1705283&r1=1705282&r2=1705283&view=diff
==============================================================================
--- sis/site/trunk/content/book/fr/developer-guide.html [UTF-8] (original)
+++ sis/site/trunk/content/book/fr/developer-guide.html [UTF-8] Fri Sep 25 12:29:31 2015
@@ -68,9 +68,9 @@
<section>
<header>
<h1 id="Foreword"><span class="section-number">1.</span> Préface</h1>
-<nav><div class="chapter-links"><div class="next-chapter"><a href="#GeoAPI">Next chapter</a> ➡</div></div></nav>
+<nav><div class="chapter-links"><div class="next-chapter"><a href="#GeoAPI">Chapitre précédent</a> ➡</div></div></nav>
</header>
-<nav>In this chapter:<ul class="toc">
+<nav>Dans ce chapitre:<ul class="toc">
<li><a href="#Standards">Standards et normes</a><ul>
<li><a href="#SpecificationTypes">Les différents types de spécifications</a></li></ul></li>
<li><a href="#About">Conventions utilisées dans ce guide</a><ul>
@@ -524,9 +524,9 @@ Mais un soin particulier doit être appo
<section>
<header>
<h1 id="GeoAPI"><span class="section-number">2.</span> GeoAPI</h1>
-<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#Foreword">Previous chapter</a></div><div class="next-chapter"><a href="#XML-ISO">Next chapter</a> ➡</div></div></nav>
+<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#Foreword">Chapitre suivant</a></div><div class="next-chapter"><a href="#XML-ISO">Chapitre précédent</a> ➡</div></div></nav>
</header>
-<nav>In this chapter:<ul class="toc">
+<nav>Dans ce chapitre:<ul class="toc">
<li><a href="#SpecificationToInterfaces">Des spécifications aux interfaces</a><ul>
<li><a href="#UML-annotation">Correspondances explicitées par l’annotation @UML</a></li>
<li><a href="#MappingToJDK">Correspondances implicites avec le JDK standard</a></li></ul></li>
@@ -1361,9 +1361,9 @@ tout en se gardant la possibilité de ba
<section>
<header>
<h1 id="XML-ISO"><span class="section-number">3.</span> Représentation des objets en <abbr>XML</abbr></h1>
-<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#GeoAPI">Previous chapter</a></div><div class="next-chapter"><a href="#Utilities">Next chapter</a> ➡</div></div></nav>
+<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#GeoAPI">Chapitre suivant</a></div><div class="next-chapter"><a href="#Utilities">Chapitre précédent</a> ➡</div></div></nav>
</header>
-<nav>In this chapter:<ul class="toc">
+<nav>Dans ce chapitre:<ul class="toc">
<li><a href="#XML-ISO-19115">Représentation des méta-données selon ISO 19115-3</a><ul>
<li><a href="#gco-id">Identification d’instances déjà définies</a></li>
<li><a href="#nilReason">Représentation de valeurs manquantes</a></li></ul></li></ul></nav>
@@ -1705,9 +1705,9 @@ et dont la méthode <code class="SIS">ge
<section>
<header>
<h1 id="Utilities"><span class="section-number">4.</span> Classes et méthodes utilitaires</h1>
-<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#XML-ISO">Previous chapter</a></div><div class="next-chapter"><a href="#Geometry">Next chapter</a> ➡</div></div></nav>
+<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#XML-ISO">Chapitre suivant</a></div><div class="next-chapter"><a href="#Geometry">Chapitre précédent</a> ➡</div></div></nav>
</header>
-<nav>In this chapter:<ul class="toc">
+<nav>Dans ce chapitre:<ul class="toc">
<li><a href="#ComparisonMode">Modes de comparaisons des objets</a></li>
<li><a href="#Internationalization">Internationalisation</a><ul>
<li><a href="#LocalizedString">Chaînes de caractères distinctes pour chaque conventions locales</a></li>
@@ -1982,9 +1982,9 @@ de la bibliothèque <abbr>SIS</abbr>.
<section>
<header>
<h1 id="Geometry"><span class="section-number">5.</span> Géométries</h1>
-<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#Utilities">Previous chapter</a></div><div class="next-chapter"><a href="#Coverage">Next chapter</a> ➡</div></div></nav>
+<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#Utilities">Chapitre suivant</a></div><div class="next-chapter"><a href="#Coverage">Chapitre précédent</a> ➡</div></div></nav>
</header>
-<nav>In this chapter:<ul class="toc">
+<nav>Dans ce chapitre:<ul class="toc">
<li><a href="#Geometry-root">Classes de base</a><ul>
<li><a href="#DirectPosition">Points et positions directes</a></li>
<li><a href="#Envelope">Enveloppes</a><ul>
@@ -2169,9 +2169,9 @@ est vrai, alors il est garanti que l’e
<section>
<header>
<h1 id="Coverage"><span class="section-number">6.</span> Couvertures de données (<i>Coverages</i>)</h1>
-<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#Geometry">Previous chapter</a></div></div></nav>
+<nav><div class="chapter-links"><div class="previous-chapter">⬅ <a href="#Geometry">Chapitre suivant</a></div></div></nav>
</header>
-<nav>In this chapter:<ul class="toc"/></nav>
+<nav>Dans ce chapitre:<ul class="toc"/></nav>
<p>
Les images, souvent nommées <i>rasters</i> en anglais, sont des cas particuliers
d’une structure de données appelée <i>coverages</i>.