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

@ -220,5 +220,17 @@
}, },
"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);
} }