Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add i18n support on distance and length text with "pt" language #81

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ export const Config = {
getProp(langCode, 'tooltipText1'),
tooltipText2: (langCode = defaultLangCode) =>
getProp(langCode, 'tooltipText2'),
distanceAndLength: (langCode = defaultLangCode) =>
getProp(langCode, 'distanceAndLength'),
};
2 changes: 2 additions & 0 deletions src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const i18n = {
en: {
tooltipText1: 'Drag to change, click to remove',
tooltipText2: 'Drag to change',
distanceAndLength: (lenght, area) => `Total distance: ${lenght}; Total area: ${area}.`
},
it: {
tooltipText1: 'Trascina per modificare, fai clic per rimuovere',
Expand All @@ -26,6 +27,7 @@ const i18n = {
pt: {
tooltipText1: 'Arraste para alterar, clique para remover',
tooltipText2: 'Arraste para alterar',
distanceAndLength: (lenght, area) => `Distância total: ${lenght}; Área total: ${area}.`
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ export default class MeasureTool {
this._nodeText
.select(':last-child')
.text(
`Total distance: ${this.lengthText}; Total area: ${this.areaText}.`
Config.distanceAndLength(this._options.language)(this.lengthText, this.areaText)
victorvuelma marked this conversation as resolved.
Show resolved Hide resolved
);
}
}
Expand Down