From c06765a5df4542390cc1149f81690c19b6b3c96d Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Mon, 21 Aug 2017 10:31:48 +0200 Subject: [PATCH] feat(i18n): translate container-details --- app/components/container/container.html | 116 +++++++++--------- app/directives/translation/por-translation.js | 5 +- app/filters/filters.js | 24 ---- app/services/translationService.js | 1 + assets/i18n/en.json | 99 ++++++++++++++- assets/i18n/fr.json | 98 ++++++++++++++- vendor.yml | 4 +- 7 files changed, 259 insertions(+), 88 deletions(-) diff --git a/app/components/container/container.html b/app/components/container/container.html index b399a1eca..4680ad3b2 100644 --- a/app/components/container/container.html +++ b/app/components/container/container.html @@ -1,27 +1,27 @@ - + - Containers > {{ container.Name|trimcontainername }} + > {{ container.Name|trimcontainername }}
- +
- - - - - - - - - + + + + + + + + +
@@ -31,16 +31,16 @@
- + - + - + - + - + - + - + - + @@ -105,23 +108,23 @@
- +
ID {{ container.Id }}
Name {{ container.Name|trimcontainername }} @@ -54,35 +54,38 @@
IP address {{ container.NetworkSettings.IPAddress }}
Status - {{ container.State|getstatetext }} since {{ activityTime }} with exit code {{ container.State.ExitCode }} + + + +
Created {{ container.Created|getisodate }}
Start time {{ container.State.StartedAt|getisodate }}
Finished {{ container.State.FinishedAt|getisodate }}
- Stats - Logs - Console + + +
- + - + - + @@ -134,15 +137,14 @@
- +
- You can create an image from this container, this allows you to backup important data or save - helpful configurations. You'll be able to spin up another container based on this image afterward. +
@@ -155,13 +157,15 @@
- Note: if you don't specify the tag in the image name, latest will be used. + + +
- +
@@ -174,16 +178,16 @@
- +
Status {{ container.State.Health.Status }}
Failure count {{ container.State.Health.FailingStreak }}
Last output {{ container.State.Health.Log[container.State.Health.Log.length - 1].Output }}
- + - + - +
Image {{ container.Image }}
Port configuration
{{ portMapping.container }} {{ portMapping.host }} @@ -206,7 +210,7 @@
Labels @@ -217,11 +221,11 @@ - +
Restart policies - + @@ -243,13 +247,13 @@
- +
Name {{ container.HostConfig.RestartPolicy.Name }}
- - + + @@ -267,11 +271,11 @@
- +
- Items per page: +
HostContainer
- - - - - + + + + + @@ -295,11 +299,13 @@ - +
Network NameIP AddressGatewayMacAddressActions
{{ value.Gateway || '-' }} {{ value.MacAddress || '-' }} - +
No networks connected. + +
@@ -310,15 +316,15 @@
- +
- +
diff --git a/app/directives/translation/por-translation.js b/app/directives/translation/por-translation.js index 84f1fb229..d166ad363 100644 --- a/app/directives/translation/por-translation.js +++ b/app/directives/translation/por-translation.js @@ -1,7 +1,8 @@ angular.module('portainer').component('porTranslation', { bindings: { 'key': '@', - 'compile': '@' + 'compile': '@', + 'values': '<' }, - template: '{{ $ctrl.key }}' + template: '{{ $ctrl.key }}' }); diff --git a/app/filters/filters.js b/app/filters/filters.js index b4cac3fe0..8b1a4d13b 100644 --- a/app/filters/filters.js +++ b/app/filters/filters.js @@ -113,30 +113,6 @@ angular.module('portainer.filters', []) return _.capitalize(text); }; }) -.filter('getstatetext', function () { - 'use strict'; - return function (state) { - if (state === undefined) { - return ''; - } - if (state.Dead) { - return 'Dead'; - } - if (state.Ghost && state.Running) { - return 'Ghost'; - } - if (state.Running && state.Paused) { - return 'Running (Paused)'; - } - if (state.Running) { - return 'Running'; - } - if (state.Status === 'created') { - return 'Created'; - } - return 'Stopped'; - }; -}) .filter('stripprotocol', function() { 'use strict'; return function (url) { diff --git a/app/services/translationService.js b/app/services/translationService.js index f7efaf795..77c7536b4 100644 --- a/app/services/translationService.js +++ b/app/services/translationService.js @@ -5,6 +5,7 @@ angular.module('portainer.services') var service = {}; service.setLang = function(lang) { + moment.locale(lang); $translate.use(lang); }; diff --git a/assets/i18n/en.json b/assets/i18n/en.json index f5f8b8c95..a568babf5 100644 --- a/assets/i18n/en.json +++ b/assets/i18n/en.json @@ -1,15 +1,38 @@ { "COMMON": { + "NOUNS": { + "STATUS": "Status", + "NAME": "Name" + }, "VERBS": { "CREATE": "Create", "REFRESH": "Refresh", "HIDE": "Hide", - "FILTER": "Filter" + "FILTER": "Filter", + "START": "Start", + "STOP": "Stop", + "KILL": "Kill", + "RESTART": "Restart", + "PAUSE": "Pause", + "RESUME": "Resume", + "REMOVE": "Remove", + "RECREATE": "Recreate", + "DUPLICATE": "Duplicate", + "EDIT": "Edit" }, "DOCKER": { + "ID": "ID", "CONTAINER": "container", + "CONTAINERS": "Containers", "VOLUME": "volume", - "HOST": "host" + "HOST": "host", + "CONTAINER_STATUS": { + "DEAD": "Dead", + "GHOST": "Ghost", + "RUNNING": "Running", + "CREATED": "Created", + "STOPPED": "Stopped" + } }, "UI": { "LOADING": "Loading...", @@ -65,6 +88,77 @@ } } }, + "CONTAINER_DETAILS": { + "HEADER": { + "TITLE": "Container details" + }, + "WIDGET_ACTIONS": { + "TITLE": "Actions" + }, + "WIDGET_CONTAINER_STATUS": { + "TITLE": "Container status", + "ROW_NAME": "Name", + "ROW_IP": "IP address", + "ROW_STATUS": "Status", + "ROW_CREATED": "Created", + "ROW_START_TIME": "Start time", + "ROW_FINISHED": "Finished", + "STATUS": { + "RUNNING": "Running since {{ time }}", + "CREATED": "Created since {{ time }}", + "STOPPED": "Stopped since {{ time }} with exit code {{ code }}", + "DEAD": "Dead since {{ time }} with exit code {{ code }}" + }, + "ACTIONS": { + "STATS": "Stats", + "LOGS": "Logs", + "CONSOLE": "Console" + } + }, + "WIDGET_CONTAINER_HEALTH": { + "TITLE": "Container health", + "FAILURE_COUNT": "Failure count", + "LAST_OUTPUT": "Last output" + }, + "WIDGET_CREATE_IMAGE": { + "TITLE": "Create image", + "DESCRIPTION": "You can create an image from this container, this allows you to backup important data or save helpful configurations. You'll be able to spin up another container based on this image afterward.", + "TAG_NOTE": "Note: if you don't specify the tag in the image name, latest will be used." + }, + "WIDGET_CONTAINER_DETAILS": { + "TITLE": "Container details", + "ROW_IMAGE": "Image", + "ROW_PORT": "Port configuration", + "ROW_LABELS": "Labels", + "ROW_RESTART_POLICIES": "Restart policies" + }, + "WIDGET_CONTAINER_VOLUMES": { + "TITLE": "Volumes", + "TABLE": { + "HEADERS": { + "HOST": "Host", + "CONTAINER": "Container" + } + } + }, + "WIDGET_CONTAINER_NETWORKS": { + "TITLE": "Connected networks", + "TABLE": { + "HEADERS": { + "NETWORK_NAME": "Network name", + "IP": "IP address", + "GATEWAY": "Gateway", + "MAC": "MAC address", + "ACTIONS": "Actions" + }, + "EMPTY": "No networks connected." + }, + "CONNECT_NETWORK": "Join a network", + "SELECT_NETWORK": "Select a network", + "CONNECT": "Join network", + "DISCONNECT": "Leaver network" + } + }, "TEMPLATES": { "HEADER": { "TITLE": "Application templates list", @@ -84,7 +178,6 @@ "LABEL": "Port mapping", "MAP_PORT": "map additional port", "NOTE": "Portainer will automatically assign a port if you leave the host port empty.", - "HOST": "host" }, "VOLUME_MAPPING": { "LABEL": "Volume mapping", diff --git a/assets/i18n/fr.json b/assets/i18n/fr.json index 7438d7fa5..69039a681 100644 --- a/assets/i18n/fr.json +++ b/assets/i18n/fr.json @@ -1,15 +1,38 @@ { "COMMON": { + "NOUNS": { + "STATUS": "Statut", + "NAME": "Nom" + }, "VERBS": { "CREATE": "Créer", "REFRESH": "Rafraîchir", "HIDE": "Cacher", - "FILTER": "Filtrer" + "FILTER": "Filtrer", + "START": "Démarrer", + "STOP": "Stopper", + "KILL": "Tuer", + "RESTART": "Redémarrer", + "PAUSE": "Pause", + "RESUME": "Reprendre", + "REMOVE": "Supprimer", + "RECREATE": "Re-créer", + "DUPLICATE": "Dupliquer", + "EDIT": "Editer" }, "DOCKER": { + "ID": "ID", "CONTAINER": "conteneur", + "CONTAINERS": "Containers", "VOLUME": "volume", - "HOST": "hôte" + "HOST": "hôte", + "CONTAINER_STATUS": { + "DEAD": "Mort", + "GHOST": "Fantôme", + "RUNNING": "Démarré", + "CREATED": "Créé", + "STOPPED": "Stoppé" + } }, "UI": { "LOADING": "Chargement...", @@ -65,6 +88,77 @@ } } }, + "CONTAINER_DETAILS": { + "HEADER": { + "TITLE": "Informations à propos du conteneur" + }, + "WIDGET_ACTIONS": { + "TITLE": "Actions" + }, + "WIDGET_CONTAINER_STATUS": { + "TITLE": "Statut du conteneur", + "ROW_NAME": "Nom", + "ROW_IP": "Adresse IP", + "ROW_STATUS": "Statut", + "ROW_CREATED": "Date de création", + "ROW_START_TIME": "Date de démarrage", + "ROW_FINISHED": "Date de fin", + "STATUS": { + "RUNNING": "Démarré depuis {{ time }}", + "CREATED": "Créé depuis {{ time }}", + "STOPPED": "Stoppé depuis {{ time }} avec code de retour {{ code }}", + "DEAD": "Mort depuis {{ time }} avec code de retour {{ code }}" + }, + "ACTIONS": { + "STATS": "Stats", + "LOGS": "Logs", + "CONSOLE": "Console" + } + }, + "WIDGET_CONTAINER_HEALTH": { + "TITLE": "Santé du conteneur (health check)", + "FAILURE_COUNT": "Nombre d'échecs", + "LAST_OUTPUT": "Dernière sortie" + }, + "WIDGET_CREATE_IMAGE": { + "TITLE": "Créer une image", + "DESCRIPTION": "Vous pouvez créer une image à partir de ce conteneur, ceci vous permettra de sauvegarder les données ou toute configuration présente dans ce conteneur. Vous pourrez ensuite démarrer un autre conteneur basé sur cette image.", + "TAG_NOTE": "Note: si vous ne spécifiez pas de tag dans le nom de l'image, le tag latest sera utilisé." + }, + "WIDGET_CONTAINER_DETAILS": { + "TITLE": "A propos du conteneur", + "ROW_IMAGE": "Image", + "ROW_PORT": "Configuration des ports", + "ROW_LABELS": "Labels", + "ROW_RESTART_POLICIES": "Politiques de redémarrage" + }, + "WIDGET_CONTAINER_VOLUMES": { + "TITLE": "Volumes", + "TABLE": { + "HEADERS": { + "HOST": "Hôte", + "CONTAINER": "Conteneur" + } + } + }, + "WIDGET_CONTAINER_NETWORKS": { + "TITLE": "Réseaux connectés", + "TABLE": { + "HEADERS": { + "NETWORK_NAME": "Nom du réseau", + "IP": "Adresse IP", + "GATEWAY": "Passerelle", + "MAC": "Adresse MAC", + "ACTIONS": "Actions" + }, + "EMPTY": "Aucun réseau connecté." + }, + "CONNECT_NETWORK": "Connecter à un réseau", + "SELECT_NETWORK": "Choisir un réseau", + "CONNECT": "Connecter", + "DISCONNECT": "Déconnecter" + } + }, "TEMPLATES": { "HEADER": { "TITLE": "Liste de templates applicatifs", diff --git a/vendor.yml b/vendor.yml index 07dd4b978..8e50de1ee 100644 --- a/vendor.yml +++ b/vendor.yml @@ -8,7 +8,7 @@ js: - bower_components/Chart.js/Chart.js - bower_components/filesize/lib/filesize.js - bower_components/lodash/dist/lodash.js - - bower_components/moment/moment.js + - bower_components/moment/min/moment-with-locales.js - bower_components/splitargs/src/splitargs.js - bower_components/toastr/toastr.js - bower_components/xterm.js/dist/xterm.js @@ -22,7 +22,7 @@ js: - bower_components/Chart.js/Chart.min.js - bower_components/filesize/lib/filesize.min.js - bower_components/lodash/dist/lodash.min.js - - bower_components/moment/min/moment.min.js + - bower_components/moment/min/moment-with-locales.min.js - bower_components/splitargs/src/splitargs.js - bower_components/toastr/toastr.min.js - bower_components/xterm.js/dist/xterm.js