Add internationalization.

This commit is contained in:
Paulo Gustavo Veiga 2022-12-21 21:22:17 -08:00
parent 94e8046bae
commit b3587acfee
11 changed files with 189 additions and 43 deletions

View File

@ -93,7 +93,7 @@
"defaultMessage": "Zoom zu passen" "defaultMessage": "Zoom zu passen"
}, },
"editor-panel.tooltip-add-icon": { "editor-panel.tooltip-add-icon": {
"defaultMessage":"Symbol hinzufügen" "defaultMessage": "Symbol hinzufügen"
}, },
"editor-panel.tooltip-add-link": { "editor-panel.tooltip-add-link": {
"defaultMessage": "Link hinzufügen" "defaultMessage": "Link hinzufügen"
@ -150,75 +150,87 @@
"defaultMessage": "Themenstil" "defaultMessage": "Themenstil"
}, },
"shortcut-help-pane.action": { "shortcut-help-pane.action": {
"defaultMessage": "Aktion" "defaultMessage": "Aktion"
}, },
"shortcut-help-pane.add-child": { "shortcut-help-pane.add-child": {
"defaultMessage": "Kinderthema hinzufügen" "defaultMessage": "Kinderthema hinzufügen"
}, },
"shortcut-help-pane.add-link": { "shortcut-help-pane.add-link": {
"defaultMessage": "Link hinzufügen" "defaultMessage": "Link hinzufügen"
}, },
"shortcut-help-pane.add-note": { "shortcut-help-pane.add-note": {
"defaultMessage": "Notiz hinzufügen" "defaultMessage": "Notiz hinzufügen"
}, },
"shortcut-help-pane.add-sibling": { "shortcut-help-pane.add-sibling": {
"defaultMessage": "Geschwisterthema hinzufügen" "defaultMessage": "Geschwisterthema hinzufügen"
}, },
"shortcut-help-pane.cancel-text-changes": { "shortcut-help-pane.cancel-text-changes": {
"defaultMessage": "Textänderungen abbrechen" "defaultMessage": "Textänderungen abbrechen"
}, },
"shortcut-help-pane.change-font-bold": { "shortcut-help-pane.change-font-bold": {
"defaultMessage": "Text in fett gedruckt" "defaultMessage": "Text in fett gedruckt"
}, },
"shortcut-help-pane.change-font-italic": { "shortcut-help-pane.change-font-italic": {
"defaultMessage": "Text in Kursivschrift ändern" "defaultMessage": "Text in Kursivschrift ändern"
}, },
"shortcut-help-pane.collapse-children": { "shortcut-help-pane.collapse-children": {
"defaultMessage": "Kinder zusammenbrechen" "defaultMessage": "Kinder zusammenbrechen"
}, },
"shortcut-help-pane.copy-and-text": { "shortcut-help-pane.copy-and-text": {
"defaultMessage": "Themen kopieren und einfügen" "defaultMessage": "Themen kopieren und einfügen"
}, },
"shortcut-help-pane.delete-topic": { "shortcut-help-pane.delete-topic": {
"defaultMessage":"Thema löschen" "defaultMessage": "Thema löschen"
}, },
"shortcut-help-pane.deselect-all-topics": { "shortcut-help-pane.deselect-all-topics": {
"defaultMessage": "Alle Themen auswählen" "defaultMessage": "Alle Themen auswählen"
}, },
"shortcut-help-pane.edit-multiline": { "shortcut-help-pane.edit-multiline": {
"defaultMessage": "Multi-Line-Thementext hinzufügen" "defaultMessage": "Multi-Line-Thementext hinzufügen"
}, },
"shortcut-help-pane.edit-topic": { "shortcut-help-pane.edit-topic": {
"defaultMessage": "Thementext bearbeiten" "defaultMessage": "Thementext bearbeiten"
}, },
"shortcut-help-pane.edit-topic-key": { "shortcut-help-pane.edit-topic-key": {
"defaultMessage": "Fang einfach an zu tippen" "defaultMessage": "Fang einfach an zu tippen"
}, },
"shortcut-help-pane.navigation": { "shortcut-help-pane.navigation": {
"defaultMessage": "navigation" "defaultMessage": "navigation"
}, },
"shortcut-help-pane.navigation-keys": { "shortcut-help-pane.navigation-keys": {
"defaultMessage": "Pfeiltasten" "defaultMessage": "Pfeiltasten"
}, },
"shortcut-help-pane.redo": { "shortcut-help-pane.redo": {
"defaultMessage": "redoEdition" "defaultMessage": "redoEdition"
}, },
"shortcut-help-pane.save-changes": { "shortcut-help-pane.save-changes": {
"defaultMessage": "Änderungen speichern" "defaultMessage": "Änderungen speichern"
}, },
"shortcut-help-pane.select-all-topics": { "shortcut-help-pane.select-all-topics": {
"defaultMessage": "Wählen Sie alle Themen aus" "defaultMessage": "Wählen Sie alle Themen aus"
}, },
"shortcut-help-pane.select-topics": { "shortcut-help-pane.select-topics": {
"defaultMessage": "Wählen Sie mehrere Themen aus" "defaultMessage": "Wählen Sie mehrere Themen aus"
}, },
"shortcut-help-pane.select-topics-keys": { "shortcut-help-pane.select-topics-keys": {
"defaultMessage": "Mausklick" "defaultMessage": "Mausklick"
}, },
"shortcut-help-pane.undo": { "shortcut-help-pane.undo": {
"defaultMessage": "Rückgängerausgabe" "defaultMessage": "Rückgängerausgabe"
}, },
"icon-picker.show-images": { "icon-picker.show-images": {
"defaultMessage": "Bilder anzeigen" "defaultMessage": "Bilder anzeigen"
},
"editor-panel.tooltip-connection-style": {
"defaultMessage": "Verbindungsstil"
},
"editor-panel.tooltip-connection-style-curved": {
"defaultMessage": "Kurve"
},
"editor-panel.tooltip-connection-style-polyline": {
"defaultMessage": "Polylinie"
},
"editor-panel.tooltip-connection-style-polyline-curved": {
"defaultMessage": "Gekrümmte Polylinie"
} }
} }

View File

@ -62,6 +62,18 @@
"editor-panel.tooltip-add-topic": { "editor-panel.tooltip-add-topic": {
"defaultMessage": "Add Topic" "defaultMessage": "Add Topic"
}, },
"editor-panel.tooltip-connection-style": {
"defaultMessage": "Connection Style"
},
"editor-panel.tooltip-connection-style-curved": {
"defaultMessage": "Curved"
},
"editor-panel.tooltip-connection-style-polyline": {
"defaultMessage": "Polyline"
},
"editor-panel.tooltip-connection-style-polyline-curved": {
"defaultMessage": "Curved Polyline"
},
"editor-panel.tooltip-delete-topic": { "editor-panel.tooltip-delete-topic": {
"defaultMessage": "Delete Topic" "defaultMessage": "Delete Topic"
}, },

View File

@ -214,5 +214,17 @@
}, },
"icon-picker.show-images": { "icon-picker.show-images": {
"defaultMessage": "Mostrar imagenes" "defaultMessage": "Mostrar imagenes"
},
"editor-panel.tooltip-connection-style": {
"defaultMessage": "Estilo de Connexión"
},
"editor-panel.tooltip-connection-style-curved": {
"defaultMessage": "Curva"
},
"editor-panel.tooltip-connection-style-polyline": {
"defaultMessage": "Polilinea"
},
"editor-panel.tooltip-connection-style-polyline-curved": {
"defaultMessage": "Polilinea Curva"
} }
} }

View File

@ -214,5 +214,17 @@
}, },
"icon-picker.show-images": { "icon-picker.show-images": {
"defaultMessage": "Afficher les images" "defaultMessage": "Afficher les images"
},
"editor-panel.tooltip-connection-style": {
"defaultMessage": "Style de connexion"
},
"editor-panel.tooltip-connection-style-curved": {
"defaultMessage": "Courbe"
},
"editor-panel.tooltip-connection-style-polyline": {
"defaultMessage": "Polyligne"
},
"editor-panel.tooltip-connection-style-polyline-curved": {
"defaultMessage": "Polyligne courbe"
} }
} }

View File

@ -131,6 +131,30 @@
"value": "Thema hinzufügen" "value": "Thema hinzufügen"
} }
], ],
"editor-panel.tooltip-connection-style": [
{
"type": 0,
"value": "Verbindungsstil"
}
],
"editor-panel.tooltip-connection-style-curved": [
{
"type": 0,
"value": "Kurve"
}
],
"editor-panel.tooltip-connection-style-polyline": [
{
"type": 0,
"value": "Polylinie"
}
],
"editor-panel.tooltip-connection-style-polyline-curved": [
{
"type": 0,
"value": "Gekrümmte Polylinie"
}
],
"editor-panel.tooltip-delete-topic": [ "editor-panel.tooltip-delete-topic": [
{ {
"type": 0, "type": 0,

View File

@ -125,6 +125,30 @@
"value": "Add Topic" "value": "Add Topic"
} }
], ],
"editor-panel.tooltip-connection-style": [
{
"type": 0,
"value": "Connection Style"
}
],
"editor-panel.tooltip-connection-style-curved": [
{
"type": 0,
"value": "Curved"
}
],
"editor-panel.tooltip-connection-style-polyline": [
{
"type": 0,
"value": "Polyline"
}
],
"editor-panel.tooltip-connection-style-polyline-curved": [
{
"type": 0,
"value": "Curved Polyline"
}
],
"editor-panel.tooltip-delete-topic": [ "editor-panel.tooltip-delete-topic": [
{ {
"type": 0, "type": 0,

View File

@ -125,6 +125,30 @@
"value": "Agregar tópico" "value": "Agregar tópico"
} }
], ],
"editor-panel.tooltip-connection-style": [
{
"type": 0,
"value": "Estilo de Connexión"
}
],
"editor-panel.tooltip-connection-style-curved": [
{
"type": 0,
"value": "Curva"
}
],
"editor-panel.tooltip-connection-style-polyline": [
{
"type": 0,
"value": "Polilinea"
}
],
"editor-panel.tooltip-connection-style-polyline-curved": [
{
"type": 0,
"value": "Polilinea Curva"
}
],
"editor-panel.tooltip-delete-topic": [ "editor-panel.tooltip-delete-topic": [
{ {
"type": 0, "type": 0,

View File

@ -125,6 +125,30 @@
"value": "Agregar Topico" "value": "Agregar Topico"
} }
], ],
"editor-panel.tooltip-connection-style": [
{
"type": 0,
"value": "Style de connexion"
}
],
"editor-panel.tooltip-connection-style-curved": [
{
"type": 0,
"value": "Courbe"
}
],
"editor-panel.tooltip-connection-style-polyline": [
{
"type": 0,
"value": "Polyligne"
}
],
"editor-panel.tooltip-connection-style-polyline-curved": [
{
"type": 0,
"value": "Polyligne courbe"
}
],
"editor-panel.tooltip-delete-topic": [ "editor-panel.tooltip-delete-topic": [
{ {
"type": 0, "type": 0,

View File

@ -158,6 +158,15 @@ export function buildEditorPanelConfig(model: Editor, intl: IntlShape): ActionCo
defaultMessage: 'Connection Style', defaultMessage: 'Connection Style',
}), }),
options: [ options: [
{
icon: <GestureOutlined />,
tooltip: intl.formatMessage({
id: 'editor-panel.tooltip-connection-style-curved',
defaultMessage: 'Curved',
}),
onClick: () => valueBulder.getConnectionStyleModel().setValue(LineType.SIMPLE_CURVED),
selected: () => valueBulder.getConnectionStyleModel().getValue() === LineType.SIMPLE_CURVED,
},
{ {
icon: <PolylineOutlined />, icon: <PolylineOutlined />,
tooltip: intl.formatMessage({ tooltip: intl.formatMessage({
@ -172,21 +181,12 @@ export function buildEditorPanelConfig(model: Editor, intl: IntlShape): ActionCo
icon: <TimelineOutined />, icon: <TimelineOutined />,
tooltip: intl.formatMessage({ tooltip: intl.formatMessage({
id: 'editor-panel.tooltip-connection-style-polyline-curved', id: 'editor-panel.tooltip-connection-style-polyline-curved',
defaultMessage: 'Polyline Curved', defaultMessage: 'Curved Polyline',
}), }),
onClick: () => valueBulder.getConnectionStyleModel().setValue(LineType.POLYLINE_CURVED), onClick: () => valueBulder.getConnectionStyleModel().setValue(LineType.POLYLINE_CURVED),
selected: () => selected: () =>
valueBulder.getConnectionStyleModel().getValue() === LineType.POLYLINE_CURVED, valueBulder.getConnectionStyleModel().getValue() === LineType.POLYLINE_CURVED,
}, },
{
icon: <GestureOutlined />,
tooltip: intl.formatMessage({
id: 'editor-panel.tooltip-connection-style-curved',
defaultMessage: 'Curved',
}),
onClick: () => valueBulder.getConnectionStyleModel().setValue(LineType.SIMPLE_CURVED),
selected: () => valueBulder.getConnectionStyleModel().getValue() === LineType.SIMPLE_CURVED,
},
], ],
disabled: () => model.getDesignerModel().filterSelectedTopics().length === 0, disabled: () => model.getDesignerModel().filterSelectedTopics().length === 0,
}; };

View File

@ -660,7 +660,7 @@ class Designer extends Events {
this._workspace.append(result); this._workspace.append(result);
children.forEach((child) => { children.forEach((child) => {
if ($defined(child)) { if (child) {
this.nodeModelToTopic(child); this.nodeModelToTopic(child);
} }
}); });
@ -690,10 +690,6 @@ class Designer extends Events {
return result; return result;
} }
/**
* @param {mindplot.model.RelationshipModel} model
* @return {mindplot.Relationship} the relationship added to the mindmap
*/
addRelationship(model: RelationshipModel): Relationship { addRelationship(model: RelationshipModel): Relationship {
const mindmap = this.getMindmap(); const mindmap = this.getMindmap();
mindmap.addRelationship(model); mindmap.addRelationship(model);
@ -881,7 +877,7 @@ class Designer extends Events {
changeConnectionStyle(type: LineType): void { changeConnectionStyle(type: LineType): void {
const validateFunc = (topic: Topic) => !topic.isCentralTopic(); const validateFunc = (topic: Topic) => !topic.isCentralTopic();
const validateError = 'Central Topic can not be changed to line figure.'; const validateError = 'Central topic connection style can not be changed for central topic.';
const topicsIds = this.getModel().filterTopicsIds(validateFunc, validateError); const topicsIds = this.getModel().filterTopicsIds(validateFunc, validateError);
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeConnectionStyleToTopic(topicsIds, type); this._actionDispatcher.changeConnectionStyleToTopic(topicsIds, type);

View File

@ -548,10 +548,17 @@ abstract class Topic extends NodeGraph {
} }
setConnectionStyle(type: LineType): void { setConnectionStyle(type: LineType): void {
this.getModel().setConnectionStyle(type); const model = this.getModel();
model.setConnectionStyle(type);
// Needs to change change all the lines types. Outgoing are part of the children. // Needs to change change all the lines types. Outgoing are part of the children.
this.getChildren().map((topic: Topic) => topic.redraw()); this.getChildren().map((topic: Topic) => topic.redraw());
// If chidren nodes does not children, set the connection style too. We don't want to have cascade changes on all the branches.
model
.getChildren()
.filter((c) => c.getChildren().length === 0)
.forEach((c) => c.setConnectionStyle(type));
} }
private _setBackgroundColor(color: string, updateModel: boolean) { private _setBackgroundColor(color: string, updateModel: boolean) {
@ -1157,7 +1164,6 @@ abstract class Topic extends NodeGraph {
private createConnectionLine(targetTopic: Topic): ConnectionLine { private createConnectionLine(targetTopic: Topic): ConnectionLine {
const type: LineType = targetTopic.getConnectionStyle(); const type: LineType = targetTopic.getConnectionStyle();
console.log(`redraw ...: ${type}`);
return new ConnectionLine(this, targetTopic, type); return new ConnectionLine(this, targetTopic, type);
} }