From: Aline Manera <alinefm(a)br.ibm.com>
The help pages will be translated so we need to adjust the build process
to generate the html (from .dita files) to all the directories and also
install the html files in the correct place according to the language.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
configure.ac | 3 +++
contrib/kimchi.spec.fedora.in | 2 +-
contrib/kimchi.spec.suse.in | 2 +-
ui/js/src/kimchi.main.js | 11 ++++++-----
ui/pages/help/Makefile.am | 16 +++++++---------
ui/pages/help/en_US/Makefile.am | 23 +++++++++++++++++++++++
ui/pages/help/pt_BR/Makefile.am | 23 +++++++++++++++++++++++
ui/pages/help/zh_CN/Makefile.am | 23 +++++++++++++++++++++++
8 files changed, 87 insertions(+), 16 deletions(-)
create mode 100644 ui/pages/help/en_US/Makefile.am
create mode 100644 ui/pages/help/pt_BR/Makefile.am
create mode 100644 ui/pages/help/zh_CN/Makefile.am
diff --git a/configure.ac b/configure.ac
index a625f35..7d76f97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,6 +81,9 @@ AC_CONFIG_FILES([
ui/libs/themes/base/images/Makefile
ui/pages/Makefile
ui/pages/help/Makefile
+ ui/pages/help/en_US/Makefile
+ ui/pages/help/pt_BR/Makefile
+ ui/pages/help/zh_CN/Makefile
ui/pages/tabs/Makefile
contrib/Makefile
contrib/DEBIAN/Makefile
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index bf80104..1cd99b0 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -172,7 +172,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/kimchi/ui/libs/themes/base/images/*.gif
%{_datadir}/kimchi/ui/libs/themes/base/jquery-ui.min.css
%{_datadir}/kimchi/ui/pages/*.html.tmpl
-%{_datadir}/kimchi/ui/pages/help/*.html
+%{_datadir}/kimchi/ui/pages/help/*/*.html
%{_datadir}/kimchi/ui/pages/tabs/*.html.tmpl
%{_sysconfdir}/kimchi/kimchi.conf
%{_sysconfdir}/kimchi/distros.d/debian.json
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index cba0899..efb2c08 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -98,7 +98,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/kimchi/ui/libs/themes/base/images/*.gif
%{_datadir}/kimchi/ui/libs/themes/base/jquery-ui.min.css
%{_datadir}/kimchi/ui/pages/*.html.tmpl
-%{_datadir}/kimchi/ui/pages/help/*.html
+%{_datadir}/kimchi/ui/pages/help/*/*.html
%{_datadir}/kimchi/ui/pages/tabs/*.html.tmpl
%{_sysconfdir}/kimchi/kimchi.conf
%{_sysconfdir}/kimchi/distros.d/debian.json
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 78206bf..ef64bf8 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -245,12 +245,13 @@ kimchi.main = function() {
};
kimchi.getHelp = function(e) {
- var url=window.location.hash;
- url = url.replace("#tabs","/help");
- if (url == "/help")
- url=url+"/index.html"
+ var url = window.location.hash;
+ var lang = kimchi.lang.get();
+ url = url.replace("#tabs", "/help/" + lang);
+ if (url == "/help" + lang)
+ url = url + "/index.html"
else
- url=url+".html";
+ url = url + ".html";
window.open(url, "Kimchi Help");
e.preventDefault();
diff --git a/ui/pages/help/Makefile.am b/ui/pages/help/Makefile.am
index 719f603..1af984a 100644
--- a/ui/pages/help/Makefile.am
+++ b/ui/pages/help/Makefile.am
@@ -14,18 +14,16 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-DITA_HTML_FILES = $(patsubst %.dita,%.html,$(wildcard *.dita))
-HTML_FILES = $(if $(DITA_HTML_FILES), $(DITA_HTML_FILES) index.html, $(wildcard *.html))
-DITA_XSL_FILE = dita-help.xsl
-
-helpdir = $(datadir)/kimchi/ui/pages/help
+SUBDIRS = en_US pt_BR zh_CN
-dist_help_DATA = $(HTML_FILES) $(NULL)
+DITA_HTML_FILES = $(patsubst %.dita,%.html,$(wildcard */*.dita))
+HTML_FILES = $(if $(DITA_HTML_FILES), $(DITA_HTML_FILES), $(wildcard */*.html))
+DITA_XSL_FILE = dita-help.xsl
-EXTRA_DIST = $(wildcard *.dita)
+EXTRA_DIST = gen-index.py
-index.html: $(wildcard *.dita)
- $(shell pwd)/gen-index.py $^ > $@
+all: $(HTML_FILES) $(wildcard */*.dita)
+ @$(foreach dir, $(dir $(wildcard */)), $(shell pwd)/gen-index.py $(wildcard
$(dir)*.dita) > $(dir)/index.html;)
%.html: %.dita $(DITA_XSL_FILE)
xsltproc -o $@ $(DITA_XSL_FILE) $<
diff --git a/ui/pages/help/en_US/Makefile.am b/ui/pages/help/en_US/Makefile.am
new file mode 100644
index 0000000..d5ab24f
--- /dev/null
+++ b/ui/pages/help/en_US/Makefile.am
@@ -0,0 +1,23 @@
+# Copyright IBM Corp, 2014
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+en_US_helpdir = $(datadir)/kimchi/ui/pages/help/en_US
+
+dist_en_US_help_DATA = $(wildcard *.html) $(NULL)
+
+EXTRA_DIST = $(wildcard *.dita)
+
+CLEANFILES = $(wildcard *.html)
diff --git a/ui/pages/help/pt_BR/Makefile.am b/ui/pages/help/pt_BR/Makefile.am
new file mode 100644
index 0000000..0f1df92
--- /dev/null
+++ b/ui/pages/help/pt_BR/Makefile.am
@@ -0,0 +1,23 @@
+# Copyright IBM Corp, 2014
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+pt_BR_helpdir = $(datadir)/kimchi/ui/pages/help/pt_BR
+
+dist_pt_BR_help_DATA = $(wildcard *.html) $(NULL)
+
+EXTRA_DIST = $(wildcard *.dita)
+
+CLEANFILES = $(wildcard *.html)
diff --git a/ui/pages/help/zh_CN/Makefile.am b/ui/pages/help/zh_CN/Makefile.am
new file mode 100644
index 0000000..8b812ff
--- /dev/null
+++ b/ui/pages/help/zh_CN/Makefile.am
@@ -0,0 +1,23 @@
+# Copyright IBM Corp, 2014
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+zh_CN_helpdir = $(datadir)/kimchi/ui/pages/help/zh_CN
+
+dist_zh_CN_help_DATA = $(wildcard *.html) $(NULL)
+
+EXTRA_DIST = $(wildcard *.dita)
+
+CLEANFILES = $(wildcard *.html)
--
1.7.10.4