PoC translation for both JSX components and Django

pull/941/head
Piero Toffanin 2020-12-14 13:55:57 -05:00
rodzic b075f24baa
commit 11ee54245d
11 zmienionych plików z 103 dodań i 71 usunięć

Wyświetl plik

@ -84,7 +84,8 @@ module.exports = {
"PluginsAPI": "PluginsAPI",
"leaflet": "leaflet",
"ReactDOM": "ReactDOM",
"React": "React"
"React": "React",
"gettext": "gettext"
},
watchOptions: {

Wyświetl plik

@ -24,6 +24,7 @@ if (!window.PluginsAPI){
'leaflet': { loader: 'globals-loader', exports: 'L' },
'ReactDOM': { loader: 'globals-loader', exports: 'ReactDOM' },
'React': { loader: 'globals-loader', exports: 'React' },
'gettext': { loader: 'globals-loader', exports: 'gettext' },
'SystemJS': { loader: 'globals-loader', exports: 'SystemJS' }
}
});

Wyświetl plik

@ -37,6 +37,7 @@
<script src="{% static 'app/js/vendor/es6-shim.min.js' %}"></script>
<script src="{% static 'app/js/vendor/jquery-1.11.2.min.js' %}"></script>
<script src="{% static 'app/js/vendor/system.js' %}"></script>
<script src="{% url 'javascript-catalog' %}"></script>
{% block headers-before-bundle %}{% endblock %}

Wyświetl plik

@ -1,4 +1,5 @@
from django.conf.urls import url, include
from django.views.i18n import JavaScriptCatalog
from .views import app as app_views, public as public_views
from .plugins.views import app_view_handler
@ -36,7 +37,10 @@ urlpatterns = [
url(r'^api/', include("app.api.urls")),
url(r'^plugins/(?P<plugin_name>[^/.]+)/(.*)$', app_view_handler)
url(r'^plugins/(?P<plugin_name>[^/.]+)/(.*)$', app_view_handler),
# TODO: add caching: https://docs.djangoproject.com/en/3.1/topics/i18n/translation/#note-on-performance
url(r'^jsi18n/', JavaScriptCatalog.as_view(packages=['app']), name='javascript-catalog'),
]
handler404 = app_views.handler404

Wyświetl plik

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-20 20:31+0000\n"
"POT-Creation-Date: 2020-12-14 18:40+0000\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"
@ -68,43 +68,43 @@ msgid ""
"a> is optional, but can increase georeferencing accuracy"
msgstr ""
#: app/templates/app/logged_in_base.html:197
#: app/templates/app/logged_in_base.html:15
msgid "Hello"
msgstr ""
#: app/templates/app/logged_in_base.html:201
#: app/templates/app/logged_in_base.html:19
msgid "Logout"
msgstr ""
#: app/templates/app/logged_in_base.html:224
#: app/templates/app/logged_in_base.html:33
msgid "Dashboard"
msgstr ""
#: app/templates/app/logged_in_base.html:273
#: app/templates/app/logged_in_base.html:79
msgid "Administration"
msgstr ""
#: app/templates/app/logged_in_base.html:276
#: app/templates/app/logged_in_base.html:84
msgid "Accounts"
msgstr ""
#: app/templates/app/logged_in_base.html:279
#: app/templates/app/logged_in_base.html:87
msgid "Groups"
msgstr ""
#: app/templates/app/logged_in_base.html:282
#: app/templates/app/logged_in_base.html:92
msgid "Brand"
msgstr ""
#: app/templates/app/logged_in_base.html:285
#: app/templates/app/logged_in_base.html:95
msgid "Theme"
msgstr ""
#: app/templates/app/logged_in_base.html:288
#: app/templates/app/logged_in_base.html:98
msgid "Plugins"
msgstr ""
#: app/templates/app/logged_in_base.html:291
#: app/templates/app/logged_in_base.html:101
msgid "Application"
msgstr ""
@ -121,38 +121,42 @@ msgid "API Version"
msgstr ""
#: app/templates/app/processing_node.html:23
msgid "ODM Version"
msgid "Engine"
msgstr ""
#: app/templates/app/processing_node.html:27
msgid "Queue Count"
msgid "Engine Version"
msgstr ""
#: app/templates/app/processing_node.html:31
msgid "Max Images Limit"
msgid "Queue Count"
msgstr ""
#: app/templates/app/processing_node.html:35
msgid "Label"
msgid "Max Images Limit"
msgstr ""
#: app/templates/app/processing_node.html:39
msgid "Last Refreshed"
msgstr ""
#: app/templates/app/processing_node.html:40
msgid "ago"
msgid "Label"
msgstr ""
#: app/templates/app/processing_node.html:43
msgid "Last Refreshed"
msgstr ""
#: app/templates/app/processing_node.html:44
msgid "ago"
msgstr ""
#: app/templates/app/processing_node.html:47
msgid "Options (JSON)"
msgstr ""
#: app/templates/app/processing_node.html:49
#: app/templates/app/processing_node.html:53
msgid "Edit"
msgstr ""
#: app/templates/app/processing_node.html:50
#: app/templates/app/processing_node.html:54
msgid "Delete"
msgstr ""
@ -164,14 +168,18 @@ msgstr ""
msgid "Create Account"
msgstr ""
#: app/views/app.py:33
#: app/views/app.py:44
msgid "First Project"
msgstr ""
#: app/views/app.py:43 app/views/public.py:25
#: app/views/app.py:54 app/views/public.py:26
msgid "Map"
msgstr ""
#: app/views/app.py:70
#: app/views/app.py:81
msgid "3D Model Display"
msgstr ""
#: plugins/cesium-ion/api_views.py:170
msgid "No matching enum type."
msgstr ""

Wyświetl plik

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-20 20:32+0000\n"
"POT-Creation-Date: 2020-12-14 18:40+0000\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"
@ -20,7 +20,3 @@ msgstr ""
#: plugins/lightning/public/Dashboard.jsx:38
msgid "Loading dashboard..."
msgstr ""
#: plugins/lightning/public/Dashboard.jsx:150
msgid "Logout"
msgstr ""

Wyświetl plik

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-20 20:31+0000\n"
"POT-Creation-Date: 2020-12-14 18:40+0000\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"
@ -69,43 +69,43 @@ msgid ""
"a> is optional, but can increase georeferencing accuracy"
msgstr ""
#: app/templates/app/logged_in_base.html:197
#: app/templates/app/logged_in_base.html:15
msgid "Hello"
msgstr ""
#: app/templates/app/logged_in_base.html:201
#: app/templates/app/logged_in_base.html:19
msgid "Logout"
msgstr ""
#: app/templates/app/logged_in_base.html:224
#: app/templates/app/logged_in_base.html:33
msgid "Dashboard"
msgstr ""
msgstr "Pannello di Controllo"
#: app/templates/app/logged_in_base.html:273
#: app/templates/app/logged_in_base.html:79
msgid "Administration"
msgstr ""
#: app/templates/app/logged_in_base.html:276
#: app/templates/app/logged_in_base.html:84
msgid "Accounts"
msgstr ""
#: app/templates/app/logged_in_base.html:279
#: app/templates/app/logged_in_base.html:87
msgid "Groups"
msgstr ""
#: app/templates/app/logged_in_base.html:282
#: app/templates/app/logged_in_base.html:92
msgid "Brand"
msgstr ""
#: app/templates/app/logged_in_base.html:285
#: app/templates/app/logged_in_base.html:95
msgid "Theme"
msgstr ""
#: app/templates/app/logged_in_base.html:288
#: app/templates/app/logged_in_base.html:98
msgid "Plugins"
msgstr ""
#: app/templates/app/logged_in_base.html:291
#: app/templates/app/logged_in_base.html:101
msgid "Application"
msgstr ""
@ -122,38 +122,42 @@ msgid "API Version"
msgstr ""
#: app/templates/app/processing_node.html:23
msgid "ODM Version"
msgid "Engine"
msgstr ""
#: app/templates/app/processing_node.html:27
msgid "Queue Count"
msgid "Engine Version"
msgstr ""
#: app/templates/app/processing_node.html:31
msgid "Max Images Limit"
msgid "Queue Count"
msgstr ""
#: app/templates/app/processing_node.html:35
msgid "Label"
msgid "Max Images Limit"
msgstr ""
#: app/templates/app/processing_node.html:39
msgid "Last Refreshed"
msgstr ""
#: app/templates/app/processing_node.html:40
msgid "ago"
msgid "Label"
msgstr ""
#: app/templates/app/processing_node.html:43
msgid "Last Refreshed"
msgstr ""
#: app/templates/app/processing_node.html:44
msgid "ago"
msgstr ""
#: app/templates/app/processing_node.html:47
msgid "Options (JSON)"
msgstr ""
#: app/templates/app/processing_node.html:49
#: app/templates/app/processing_node.html:53
msgid "Edit"
msgstr ""
#: app/templates/app/processing_node.html:50
#: app/templates/app/processing_node.html:54
msgid "Delete"
msgstr ""
@ -165,14 +169,18 @@ msgstr ""
msgid "Create Account"
msgstr ""
#: app/views/app.py:33
#: app/views/app.py:44
msgid "First Project"
msgstr ""
#: app/views/app.py:43 app/views/public.py:25
#: app/views/app.py:54 app/views/public.py:26
msgid "Map"
msgstr ""
#: app/views/app.py:70
#: app/views/app.py:81
msgid "3D Model Display"
msgstr ""
#: plugins/cesium-ion/api_views.py:170
msgid "No matching enum type."
msgstr ""

Wyświetl plik

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-20 20:32+0000\n"
"POT-Creation-Date: 2020-12-14 18:40+0000\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"
@ -20,8 +20,4 @@ msgstr ""
#: plugins/lightning/public/Dashboard.jsx:38
msgid "Loading dashboard..."
msgstr ""
#: plugins/lightning/public/Dashboard.jsx:150
msgid "Logout"
msgstr ""
msgstr "Caricando il pannello di controllo..."

Wyświetl plik

@ -2,7 +2,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import Login from './Login';
import Dashboard from './Dashboard';
import $ from 'jquery';
export default class LightningPanel extends React.Component {
static defaultProps = {

Wyświetl plik

@ -1,6 +1,21 @@
for lang in it
do
django-admin makemessages --keep-pot --locale=$lang --ignore=app/templates/app/admin/* --ignore=app/templates/app/registration/*
django-admin makemessages --keep-pot --locale=$lang -d djangojs --extension jsx
done
django-admin compilemessages
#!/bin/bash
LOCALES="it"
if [[ "$1" == "extract" ]]; then
echo "Extracting .po files from Django/React"
locale_param=""
for lang in $LOCALES
do
locale_param="--locale=$lang $locale_param"
done
mkdir -p locale
django-admin makemessages --keep-pot $locale_param --ignore=build --ignore=app/templates/app/admin/* --ignore=app/templates/app/registration/*
django-admin makemessages --keep-pot $locale_param -d djangojs --extension jsx --ignore=build
fi
if [[ "$1" == "build" ]]; then
echo "Building .po files into .mo"
django-admin compilemessages
fi

Wyświetl plik

@ -188,6 +188,9 @@ USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCALE_PATHS = [
os.path.join(BASE_DIR, 'locale')
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/