Mercurial > gemma
changeset 4665:c47c8085cc7e
client: translation: implement marking of diagram labels
* mark date/time strings of diagrams labels for translations
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Mon, 14 Oct 2019 16:26:46 +0200 |
parents | 7d2463c7b4ad |
children | 5fb3134c3a0c |
files | client/src/components/fairway/AvailableFairwayDepth.vue client/src/components/fairway/AvailableFairwayDepthLNWL.vue client/src/components/gauge/HydrologicalConditions.vue client/src/components/gauge/Waterlevel.vue client/src/lib/datelocalization.js |
diffstat | 5 files changed, 63 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepth.vue Mon Oct 14 16:10:31 2019 +0200 +++ b/client/src/components/fairway/AvailableFairwayDepth.vue Mon Oct 14 16:26:46 2019 +0200 @@ -92,6 +92,7 @@ import { displayError } from "@/lib/errors"; import { FREQUENCIES } from "@/store/fairwayavailability"; import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate"; +import { localeDateString } from "@/lib/datelocalization"; export default { mixins: [diagram, pdfgen, templateLoader], @@ -370,6 +371,7 @@ }; }, drawDiagram() { + d3.timeFormatDefaultLocale(localeDateString); const elem = document.querySelector("#" + this.containerId); const svgWidth = elem != null ? elem.clientWidth : 0; const svgHeight = elem != null ? elem.clientHeight : 0;
--- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue Mon Oct 14 16:10:31 2019 +0200 +++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue Mon Oct 14 16:26:46 2019 +0200 @@ -92,6 +92,7 @@ import { displayError } from "@/lib/errors"; import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate"; import sanitize from "sanitize-filename"; +import { localeDateString } from "@/lib/datelocalization"; export default { mixins: [diagram, pdfgen, templateLoader], @@ -364,6 +365,7 @@ }; }, drawDiagram() { + d3.timeFormatDefaultLocale(localeDateString); const elem = document.querySelector("#" + this.containerId); const svgWidth = elem != null ? elem.clientWidth : 0; const svgHeight = elem != null ? elem.clientHeight : 0;
--- a/client/src/components/gauge/HydrologicalConditions.vue Mon Oct 14 16:10:31 2019 +0200 +++ b/client/src/components/gauge/HydrologicalConditions.vue Mon Oct 14 16:26:46 2019 +0200 @@ -116,6 +116,7 @@ import { HTTP } from "@/lib/http"; import { displayError } from "@/lib/errors"; import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate"; +import { localeDateString } from "@/lib/datelocalization"; import sanitize from "sanitize-filename"; export default { @@ -324,6 +325,7 @@ drawDiagram() { // remove old diagram d3.select("#" + this.containerId + " svg").remove(); + d3.timeFormatDefaultLocale(localeDateString); const el = document.querySelector("#" + this.containerId); if (!this.selectedGaugeD || !this.longtermWaterlevels.length || !el) return;
--- a/client/src/components/gauge/Waterlevel.vue Mon Oct 14 16:10:31 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Mon Oct 14 16:26:46 2019 +0200 @@ -127,6 +127,7 @@ import { displayError } from "@/lib/errors"; import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate"; import sanitize from "sanitize-filename"; +import { localeDateString } from "@/lib/datelocalization"; // we should load only d3 modules we need but for now we'll go with the lazy way // https://www.giacomodebidda.com/how-to-import-d3-plugins-with-webpack/ // d3-line-chunked plugin: https://github.com/pbeshai/d3-line-chunked @@ -318,6 +319,7 @@ drawDiagram(zoom) { // remove old diagram and exit if necessary data is missing d3.select("#" + this.containerId + " svg").remove(); + d3.timeFormatDefaultLocale(localeDateString); const elem = document.querySelector("#" + this.containerId); const svgWidth = elem.clientWidth; const svgHeight = elem.clientHeight;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/lib/datelocalization.js Mon Oct 14 16:26:46 2019 +0200 @@ -0,0 +1,55 @@ +import app from "@/main"; +const localeDateString = { + dateTime: app.$gettext("%a %e %b %X %Y"), + date: app.$gettext("%d/%m/%Y"), + time: app.$gettext("%H:%M:%S"), + periods: [app.$gettext("AM"), app.$gettext("PM")], + days: [ + app.$gettext("Sunday"), + app.$gettext("Monday"), + app.$gettext("Tuesday"), + app.$gettext("Wednesday"), + app.$gettext("Thursday"), + app.$gettext("Friday"), + app.$gettext("Saturday") + ], + shortDays: [ + app.$gettext("Sun"), + app.$gettext("Mon"), + app.$gettext("Tue"), + app.$gettext("Wed"), + app.$gettext("Thu"), + app.$gettext("Fri"), + app.$gettext("Sat") + ], + months: [ + app.$gettext("January"), + app.$gettext("February"), + app.$gettext("March"), + app.$gettext("April"), + app.$gettext("May"), + app.$gettext("June"), + app.$gettext("July"), + app.$gettext("August"), + app.$gettext("September"), + app.$gettext("October"), + app.$gettext("November"), + app.$gettext("December") + ], + shortMonths: [ + app.$gettext("Jan"), + app.$gettext("Feb"), + app.$gettext("Mar"), + app.$gettext("Apr"), + app.$gettext("May"), + app.$gettext("Jun"), + app.$gettext("Jul"), + app.$gettext("Aug"), + app.$gettext("Sep"), + app.$gettext("Oct"), + app.$gettext("Nov"), + app.$gettext("Dec") + ] +}; + +export { localeDateString };