Measure plugin translation

pull/943/head
Piero Toffanin 2020-12-21 20:07:03 -05:00
rodzic d1b15c0077
commit 15e2d64c41
3 zmienionych plików z 38 dodań i 3 usunięć

Wyświetl plik

@ -5,5 +5,8 @@ module.exports = {
_: window.gettext,
interpolate: function(text, params = {}){
return window.interpolate(text, params, true);
}
},
get_format: function(format_type){
return window.get_format(format_type);
}
}

Wyświetl plik

@ -20,3 +20,7 @@ XMLHttpRequest.prototype.abort = () => {};
// Missing canvas methods
HTMLCanvasElement.prototype.getContext = () => null;
// Translation methods provided by Django
global.gettext = v => v;
global.interpolate = (v, opt) => v;

Wyświetl plik

@ -7,7 +7,7 @@ import Utils from 'webodm/classes/Utils';
import ReactDOM from 'ReactDOM';
import React from 'React';
import $ from 'jquery';
import { _ } from 'webodm/classes/gettext';
import { _, get_format } from 'webodm/classes/gettext';
export default class App{
constructor(map){
@ -16,7 +16,33 @@ export default class App{
const measure = L.control.measure({
labels:{
measureDistancesAndAreas: _('Measure volume, area and length'),
areaMeasurement: _('Measurement')
areaMeasurement: _('Measurement'),
measure: _("Measure"),
createNewMeasurement: _("Create a new measurement"),
startCreating: _("Start creating a measurement by adding points to the map"),
finishMeasurement: _("Finish measurement"),
lastPoint: _("Last point"),
area: _("Area"),
perimeter: _("Perimeter"),
pointLocation: _("Point location"),
linearMeasurement: _("Linear measurement"),
pathDistance: _("Path distance"),
centerOnArea: _("Center on this area"),
centerOnLine: _("Center on this line"),
centerOnLocation: _("Center on this location"),
cancel: _("Cancel"),
delete: _("Delete"),
acres: _("Acres"),
feet: _("Feet"),
kilometers: _("Kilometers"),
hectares: _("Hectares"),
meters: _("Meters"),
miles: _("Miles"),
sqfeet: _("Sq Feet"),
sqmeters: _("Sq Meters"),
sqmiles: _("Sq Miles"),
decPoint: get_format("DECIMAL_SEPARATOR"),
thousandsSep: get_format("THOUSAND_SEPARATOR")
},
primaryLengthUnit: 'meters',
secondaryLengthUnit: 'feet',
@ -24,6 +50,8 @@ export default class App{
secondaryAreaUnit: 'acres'
}).addTo(map);
// measure.options.labels.
const $btnExport = $(`<br/><a href='#' class='js-start start'>${_("Export Measurements")}</a>`);
$btnExport.appendTo($(measure.$startPrompt).children("ul.tasks"));
$btnExport.on('click', () => {