Browse Source

Fix gettext, prepare French translation and fix headers

Julien VAUBOURG 9 years ago
parent
commit
806c721ced

+ 3 - 2
sources/config.php

@@ -1,8 +1,9 @@
 <?php
 
-/* Wifi Hotspot app for YunoHost 
+/* Tor Client app for YunoHost 
+ * Copyright (C) 2015 Émile Morel <emile@bleuchtang.fr>
  * Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
- * Contribute at https://github.com/jvaubourg/hotspot_ynh
+ * Contribute at https://github.com/labriqueinternet/torclient_ynh
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by

+ 19 - 0
sources/controller.php

@@ -1,5 +1,24 @@
 <?php
 
+/* Tor Client app for YunoHost 
+ * Copyright (C) 2015 Émile Morel <emile@bleuchtang.fr>
+ * Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
+ * Contribute at https://github.com/labriqueinternet/torclient_ynh
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program 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 Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 function moulinette_hotspot_get($var) {
   return htmlspecialchars(exec('sudo yunohost app setting hotspot '.escapeshellarg($var)));
 }

+ 45 - 0
sources/i18n/README.md

@@ -0,0 +1,45 @@
+## Force language
+
+The default language of the web admin depends on your browser language.
+
+You can force a language by using (e.g. for French):
+```
+/torclientadmin/?/lang/fr
+```
+
+English is the default language when the browser language is not available.
+
+## Update the default string list
+
+Updating the pot file from template files:
+```
+xgettext sources/views/* -o sources/i18n/localization.pot
+```
+
+## Add a new language
+
+Create a new directory path (e.g. for French):
+```
+mkdir -p sources/i18n/fr_FR/LC_MESSAGES/
+```
+
+Generate the po file:
+```
+msginit --locale=fr_FR.UTF-8 --no-translator -i sources/i18n/localization.pot -o sources/i18n/fr_FR/LC_MESSAGES/localization.po
+```
+
+You can use poedit for translating the po:
+```
+poedit sources/i18n/fr_FR/LC_MESSAGES/localization.po
+```
+
+With poedit, just save your modifications with the button and the *localization.mo* (compiled version of the po) file will automatically be created or updated.
+
+If you edited the po by hand, you have to compile the mo file:
+```
+msgfmt sources/i18n/fr_FR/localization.po -o sources/i18n/fr_FR/LC_MESSAGES/localization.mo
+```
+
+Change the default language of your browser, and test this new translation.
+
+You should add the locale to the list at the end of *sources/controller.php*.

+ 87 - 0
sources/i18n/fr_FR/LC_MESSAGES/localization.po

@@ -0,0 +1,87 @@
+# French translations for PACKAGE package.
+# Copyright (C) 2015 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Automatically generated, 2015.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-07-08 19:31+0200\n"
+"PO-Revision-Date: 2015-07-08 19:31+0200\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ASCII\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: sources/views/layout.html.php:9
+msgid "Tor Client"
+msgstr ""
+
+#: sources/views/layout.html.php:25
+msgid "Error"
+msgstr ""
+
+#: sources/views/layout.html.php:30 sources/views/settings.html.php:42
+msgid "Notice"
+msgstr ""
+
+#: sources/views/layout.html.php:42
+msgid "Any problem? Contribute!"
+msgstr ""
+
+#: sources/views/settings.html.php:1
+msgid "Tor client configuration"
+msgstr ""
+
+#: sources/views/settings.html.php:3 sources/views/settings.html.php:5
+msgid ""
+"This is a fast status. Click on More details to show the complete status."
+msgstr ""
+
+#: sources/views/settings.html.php:3
+msgid "Running"
+msgstr ""
+
+#: sources/views/settings.html.php:5
+msgid "Not Running"
+msgstr ""
+
+#: sources/views/settings.html.php:8
+msgid "Loading complete status may take a few minutes. Be patient."
+msgstr ""
+
+#: sources/views/settings.html.php:8
+msgid "More details"
+msgstr ""
+
+#: sources/views/settings.html.php:24
+msgid "Service"
+msgstr ""
+
+#: sources/views/settings.html.php:30
+msgid "Tor Enabled"
+msgstr ""
+
+#: sources/views/settings.html.php:42
+msgid "You need to select an associated hotspot."
+msgstr ""
+
+#: sources/views/settings.html.php:46
+msgid "Associated Hotspot"
+msgstr ""
+
+#: sources/views/settings.html.php:50
+msgid "None"
+msgstr ""
+
+#: sources/views/settings.html.php:62
+msgid "Reloading may take a few minutes. Be patient."
+msgstr ""
+
+#: sources/views/settings.html.php:62
+msgid "Save and reload"
+msgstr ""

+ 87 - 0
sources/i18n/localization.pot

@@ -0,0 +1,87 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-07-08 19:31+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sources/views/layout.html.php:9
+msgid "Tor Client"
+msgstr ""
+
+#: sources/views/layout.html.php:25
+msgid "Error"
+msgstr ""
+
+#: sources/views/layout.html.php:30 sources/views/settings.html.php:42
+msgid "Notice"
+msgstr ""
+
+#: sources/views/layout.html.php:42
+msgid "Any problem? Contribute!"
+msgstr ""
+
+#: sources/views/settings.html.php:1
+msgid "Tor client configuration"
+msgstr ""
+
+#: sources/views/settings.html.php:3 sources/views/settings.html.php:5
+msgid ""
+"This is a fast status. Click on More details to show the complete status."
+msgstr ""
+
+#: sources/views/settings.html.php:3
+msgid "Running"
+msgstr ""
+
+#: sources/views/settings.html.php:5
+msgid "Not Running"
+msgstr ""
+
+#: sources/views/settings.html.php:8
+msgid "Loading complete status may take a few minutes. Be patient."
+msgstr ""
+
+#: sources/views/settings.html.php:8
+msgid "More details"
+msgstr ""
+
+#: sources/views/settings.html.php:24
+msgid "Service"
+msgstr ""
+
+#: sources/views/settings.html.php:30
+msgid "Tor Enabled"
+msgstr ""
+
+#: sources/views/settings.html.php:42
+msgid "You need to select an associated hotspot."
+msgstr ""
+
+#: sources/views/settings.html.php:46
+msgid "Associated Hotspot"
+msgstr ""
+
+#: sources/views/settings.html.php:50
+msgid "None"
+msgstr ""
+
+#: sources/views/settings.html.php:62
+msgid "Reloading may take a few minutes. Be patient."
+msgstr ""
+
+#: sources/views/settings.html.php:62
+msgid "Save and reload"
+msgstr ""

+ 19 - 3
sources/index.php

@@ -1,11 +1,27 @@
 <?php
 
+/* Tor Client app for YunoHost 
+ * Copyright (C) 2015 Émile Morel <emile@bleuchtang.fr>
+ * Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
+ * Contribute at https://github.com/labriqueinternet/torclient_ynh
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program 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 Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 require dirname(__FILE__).'/lib/limonade.php';
 require dirname(__FILE__).'/controller.php';
-
 require dirname(__FILE__).'/lib/unix_func.php';
-//require '/usr/share/php/php-gettext/gettext.inc';
-
 require dirname(__FILE__).'/config.php';
 
 run();

+ 19 - 0
sources/public/css/style.css

@@ -1,3 +1,22 @@
+/* Tor Client app for YunoHost 
+ * Copyright (C) 2015 Émile Morel <emile@bleuchtang.fr>
+ * Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
+ * Contribute at https://github.com/labriqueinternet/torclient_ynh
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program 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 Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 li.status-info {
   color: #5BC0DE;
 }

+ 19 - 0
sources/public/js/custom.js

@@ -1,3 +1,22 @@
+/* Tor Client app for YunoHost 
+ * Copyright (C) 2015 Émile Morel <emile@bleuchtang.fr>
+ * Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
+ * Contribute at https://github.com/labriqueinternet/torclient_ynh
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program 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 Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 $(document).ready(function() {
   $('.btn-group').button();
   $('[data-toggle="tooltip"]').tooltip();

+ 25 - 1
sources/views/layout.html.php

@@ -1,17 +1,41 @@
 <!doctype html>
+
+<!--
+  Tor Client app for YunoHost 
+  Copyright (C) 2015 Émile Morel <emile@bleuchtang.fr>
+  Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
+  Contribute at https://github.com/labriqueinternet/torclient_ynh
+  
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+  
+  This program 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 Affero General Public License for more details.
+  
+  You should have received a copy of the GNU Affero General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+
 <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
 <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
 <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
 <!--[if gt IE 8]><!--> <html class="no-js" lang="<?= $locale ?>"> <!--<![endif]-->
 <head>
+  <title><?= _("Tor Client") ?><?= isset($title) ? " | $title" : '' ?></title>
+
   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-  <title><?= _("Tor Client") ?><?= isset($title) ? " | $title" : '' ?></title>
   <meta name="viewport" content="width=device-width">
+
   <link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/bootstrap/css/bootstrap.min.css" rel="stylesheet">
   <link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
   <link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/css/bootstrap-toggle.min.css" rel="stylesheet">
   <link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/css/style.css" rel="stylesheet">
+
   <script src="<?= PUBLIC_DIR ?>/jquery/jquery-2.1.1.min.js"></script>
   <script src="<?= PUBLIC_DIR ?>/bootstrap/js/bootstrap.min.js"></script>
   <script src="<?= PUBLIC_DIR ?>/js/bootstrap-toggle.min.js"></script>

+ 21 - 1
sources/views/settings.html.php

@@ -1,4 +1,24 @@
-<h2><?= _("Tor client configuration") ?></h2>
+<!--
+  Tor Client app for YunoHost 
+  Copyright (C) 2015 Émile Morel <emile@bleuchtang.fr>
+  Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
+  Contribute at https://github.com/labriqueinternet/torclient_ynh
+  
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+  
+  This program 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 Affero General Public License for more details.
+  
+  You should have received a copy of the GNU Affero General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<h2><?= _("Tor Client Configuration") ?></h2>
 <?php if($faststatus): ?>
   <span class="label label-success" data-toggle="tooltip" data-title="<?= _('This is a fast status. Click on More details to show the complete status.') ?>"><?= _('Running') ?></span>
 <?php else: ?>