From 38b148ce525709f6b2d4c8952445c4fd396ed10c Mon Sep 17 00:00:00 2001 From: vdelachaux Date: Wed, 22 Jan 2025 18:51:37 +0100 Subject: [PATCH] wip --- Project/Sources/Classes/Xliff.4dm | 19 ++ .../Sources/Classes/_WIZARD_Controller.4dm | 10 +- Project/Sources/Forms/WIZARD/form.4DForm | 60 ++--- Project/Sources/Methods/EDITOR OPEN.4dm | 19 +- Project/Sources/folders.json | 4 +- Resources/en.lproj/Xliff Editor.xlf | 235 ++++++++-------- Resources/fr.lproj/Xliff Editor.xlf | 254 +++++++++--------- 7 files changed, 332 insertions(+), 269 deletions(-) diff --git a/Project/Sources/Classes/Xliff.4dm b/Project/Sources/Classes/Xliff.4dm index caedb98..0522e0b 100644 --- a/Project/Sources/Classes/Xliff.4dm +++ b/Project/Sources/Classes/Xliff.4dm @@ -555,6 +555,7 @@ Function synchronize($file : 4D:C1709.File; $targetLanguage : Text) var $group : cs:C1710.XliffGroup var $unit : cs:C1710.XliffUnit var $xliff : cs:C1710.Xliff + var $oo : Object If (Not:C34($file.exists)) @@ -630,6 +631,7 @@ Function synchronize($file : 4D:C1709.File; $targetLanguage : Text) For each ($unit; $group.transunits.orderBy("resname")) $string:=Null:C1517 + $oo:=Null:C1517 $o:=$xliff.groups.query("transunits[].id = :1"; $unit.id).first() @@ -637,6 +639,17 @@ Function synchronize($file : 4D:C1709.File; $targetLanguage : Text) $string:=$o.transunits.query("id = :1"; $unit.id).first() + If ($string#Null:C1517) + + // Search for the same resname with a different ID + $oo:=$xliff.groups.query("transunits[].resname = :1"; $unit.resname).first() + + If ($oo#Null:C1517) + + $oo:=$oo.transunits.query("id != :1 & resname = :2"; $unit.id; $unit.resname).first() + + End if + End if End if If ($string=Null:C1517) @@ -651,6 +664,12 @@ Function synchronize($file : 4D:C1709.File; $targetLanguage : Text) End if End if + + If ($oo#Null:C1517) + + $xliff.remove($oo.node) + + End if End for each End for each End if diff --git a/Project/Sources/Classes/_WIZARD_Controller.4dm b/Project/Sources/Classes/_WIZARD_Controller.4dm index e1a3660..33bc601 100644 --- a/Project/Sources/Classes/_WIZARD_Controller.4dm +++ b/Project/Sources/Classes/_WIZARD_Controller.4dm @@ -10,6 +10,10 @@ property source : cs:C1710.button property targetAdd; targetRemove : cs:C1710.button property targets : cs:C1710.listbox +// MARK: Form +property reference : cs:C1710.language +property languages : Collection + Class constructor // MARK:Delegates 📦 @@ -121,7 +125,8 @@ Function doSelectSourceLanguage() End for each - $menu.line() + $menu.line()\ + .append(Localized string:C991("availableLanguages")).disable() End if @@ -186,8 +191,7 @@ Function doDeleteLanguage() If (Not:C34(Bool:C1537(OK))) - // FIXME: To translate - CONFIRM:C162(".The content of this language folder will be deleted"; ".Delete") + CONFIRM:C162(Replace string:C233(Localized string:C991("theFolderWillBeDeleted"); "{lang}"; $folder.fullName); Localized string:C991("remove")) End if diff --git a/Project/Sources/Forms/WIZARD/form.4DForm b/Project/Sources/Forms/WIZARD/form.4DForm index a2149ab..adba0a2 100755 --- a/Project/Sources/Forms/WIZARD/form.4DForm +++ b/Project/Sources/Forms/WIZARD/form.4DForm @@ -21,15 +21,15 @@ "Text4": { "type": "text", "text": ":xliff:wizardComment", - "top": 54, - "left": 45, + "top": 74, + "left": 21, "width": 573, "height": 184 }, "reference language flag": { "type": "input", - "left": 252, - "top": 242, + "left": 227, + "top": 262, "width": 53, "height": 30, "dataSource": "Form:C1466.reference.flag", @@ -45,8 +45,8 @@ "Text8": { "type": "text", "text": ".Source language:", - "top": 249, - "left": 72, + "top": 269, + "left": 47, "width": 180, "height": 16, "fontTheme": "normal", @@ -55,8 +55,8 @@ }, "source": { "type": "button", - "top": 249, - "left": 301, + "top": 269, + "left": 276, "width": 266, "height": 17, "events": [ @@ -71,8 +71,8 @@ }, "List Box": { "type": "listbox", - "left": 262, - "top": 275, + "left": 237, + "top": 295, "width": 307, "height": 209, "events": [ @@ -84,7 +84,7 @@ "verticalLineStroke": "transparent", "fill": "transparent", "scrollbarVertical": "automatic", - "right": 569, + "right": 544, "sizingY": "grow", "currentItemSource": "formGetInstance.targets.item", "currentItemPositionSource": "formGetInstance.targets.itemPosition", @@ -125,8 +125,8 @@ "Text2": { "type": "text", "text": ".Target languages:", - "top": 283, - "left": 83, + "top": 303, + "left": 58, "width": 169, "height": 16, "textAlign": "right", @@ -134,8 +134,8 @@ }, "Button3": { "type": "button", - "top": 489, - "left": 262, + "top": 509, + "left": 237, "width": 16, "height": 16, "events": [ @@ -148,8 +148,8 @@ }, "Button4": { "type": "button", - "top": 489, - "left": 284, + "top": 509, + "left": 259, "width": 16, "height": 16, "events": [ @@ -162,8 +162,8 @@ }, "Line2": { "type": "line", - "top": 484, - "left": 261, + "top": 504, + "left": 236, "width": 308, "height": 0, "sizingY": "move" @@ -172,17 +172,17 @@ "type": "text", "text": ":xliff:thisIsTheFirstTime", "top": 18, - "left": 0, - "width": 663, - "height": 31, + "left": 21, + "width": 573, + "height": 46, "textAlign": "center", "fontTheme": "main" }, "Button": { "type": "button", "text": ":xliff:OKButton", - "top": 527, - "left": 550, + "top": 547, + "left": 525, "width": 68, "height": 29, "events": [ @@ -194,8 +194,8 @@ "Button5": { "type": "button", "text": ":xliff:CancelButton", - "top": 527, - "left": 449, + "top": 547, + "left": 424, "width": 81, "height": 29, "events": [ @@ -212,15 +212,15 @@ }, "Line1": { "type": "line", - "top": 275, - "left": 261, + "top": 295, + "left": 236, "width": 308, "height": 0 } } } ], - "geometryStamp": 479, + "geometryStamp": 495, "editor": { "activeView": "View 1", "defaultView": "View 1", @@ -230,7 +230,7 @@ }, "method": "formMethod", "windowSizingX": "fixed", - "rightMargin": 0, + "rightMargin": 20, "bottomMargin": 20, "windowMinHeight": 500 } \ No newline at end of file diff --git a/Project/Sources/Methods/EDITOR OPEN.4dm b/Project/Sources/Methods/EDITOR OPEN.4dm index 2ad968c..192fd84 100644 --- a/Project/Sources/Methods/EDITOR OPEN.4dm +++ b/Project/Sources/Methods/EDITOR OPEN.4dm @@ -26,7 +26,22 @@ If ($run) var $data:={} var $pref:=cs:C1710.Preferences.new() - If (Not:C34($pref.exists("wizard"))) + var $runWizard:=Not:C34($pref.exists("wizard")) + + If (Not:C34($runWizard)) + + // Checking for changes… + var $editor:=cs:C1710._Editor.new() + $runWizard:=$pref.get("sourceLanguage")#$editor.getLanguage($editor.mainLanguage).lproj + + If (Not:C34($runWizard)) + + $runWizard:=Not:C34($pref.get("targetLanguages").equal($editor.targetLanguages().extract("lproj"))) + + End if + End if + + If ($runWizard) | Shift down:C543 // First launch $data.window:=Open form window:C675("WIZARD"; Movable form dialog box:K39:8; Horizontally centered:K39:1; Vertically centered:K39:4) @@ -60,4 +75,4 @@ Else CALL WORKER:C1389($name; Current method name:C684; True:C214) -End if \ No newline at end of file +End if diff --git a/Project/Sources/folders.json b/Project/Sources/folders.json index ce81744..a5e0538 100755 --- a/Project/Sources/folders.json +++ b/Project/Sources/folders.json @@ -88,7 +88,7 @@ "groups": [ "_UPDATES", "EDITOR", - "Wizard" + "WIZARD" ], "classes": [ "_Editor" @@ -163,7 +163,7 @@ "WRAP_AROUND" ] }, - "Wizard": { + "WIZARD": { "forms": [ "WIZARD" ], diff --git a/Resources/en.lproj/Xliff Editor.xlf b/Resources/en.lproj/Xliff Editor.xlf index 1c5df8b..9d13017 100755 --- a/Resources/en.lproj/Xliff Editor.xlf +++ b/Resources/en.lproj/Xliff Editor.xlf @@ -19,85 +19,85 @@ This file is distributed under the same license as the product package. - + Save Save - + Cancel Cancel - + OK OK - + Yes Yes - + No No - + New New - + Edition Edition - + Source Source - + Change… Change… - + Make IDs unique Make IDs unique - + File name: File name: - + Are you sure that you want to delete the group "{item}" ? Are you sure that you want to delete the group "{item}" ? - + Are you sure that you want to delete the item "{item}" ? Are you sure that you want to delete the item "{item}" ? - + Are you sure? Are you sure? - + Are you sure that you want to delete the file "{filename}"? Are you sure that you want to delete the file "{filename}"? - + The name "{name}" is already taken. Please choose a different name. The name "{name}" is already taken. Please choose a different name. - + The name must not be empty. Please enter a valid name. The name must not be empty. Please enter a valid name. - + Select the xliff file to import Select the xliff file to import - + Modifications are not allowed because the IDs are not unique Modifications are not allowed because the IDs are not unique - + The file {name} already exists. Do you want to replace it? @@ -105,7 +105,7 @@ Do you want to replace it? Do you want to replace it? - + Making the IDs unique will prevent the old command "{command}" from being used. Changes will be saved and cannot be undone. @@ -113,362 +113,362 @@ Changes will be saved and cannot be undone. Changes will be saved and cannot be undone. - + I have understood well I have understood well - + Unique IDs assignment failure Unique IDs assignment failure - + New file New file - + Add a group in the current file Add a group in the current file - + Add a string to the current group Add a string to the current group - + Current file's info Current file's info - + Preferences Preferences - + Switch between the editor and the pallet Switch between the editor and the pallet - + Show or Hide the string box Show or Hide the string box - + Show or Hide the attributes box Show or Hide the attributes box - + XLIFF 1.0 Specification XLIFF 1.0 Specification - + Short cuts for the current actions. Short cuts for the current actions. - + A multilingual XLIFF editor A multilingual XLIFF editor - + Group Group - + String String - + File File - + New File New File - + New New - + File... File... - + Fill in Fill in - + Preferences… Preferences… - + Rename… Rename… - + Delete.… Delete.… - + File informations… File informations… - + Add a group Add a group - + Show on disk Show on disk - + Validate using the DTD Validate using the DTD - + Editor… Editor… - + Set reference value to all languages Set reference value to all languages - + Prefix with the group name Prefix with the group name - + Add a comment Add a comment - + Edit comment Edit comment - + Close comment Close comment - + All All - + Operating Systems Operating Systems - + Project Settings… Project Settings… - + Import… Import… - + XLIFF reference XLIFF reference - + 4D Code 4D Code - + Resname Resname - + New Group New Group - + New String New String - + Duplicate Duplicate - + Menu Menu - + Close Close - + Code for Code for - + Window Window - + Find Find - + Find next Find next - + Xliff Editor Xliff Editor - + Xliff - + Find... Find... - + Don't save Don't save - + Resources Folder Resources Folder - + Default values Default values - + Use the database's folder Use the database's folder - + Use the folder: Use the folder: - + Comments Comments - + Metal Window Metal Window - + Languages Languages - + General General - + Database Database - + Attributes Attributes - + Values Values - + Select the Target Resource Folder. Select the Target Resource Folder. - + Use group's resname Use group's resname - + Use prefix: Use prefix: - + Separating character: Separating character: - + Escaped characters Escaped characters - + Maximum size of the resname Maximum size of the resname - + Advanced Advanced - + Files Files - + Drag & drop in form: Drag & drop in form: - + Styled text Styled text - + Localization Localization - + Project Project - + Languages Languages - + Reference Reference - + Localizations Localizations - + Filter Filter - + File File - + xliff PUBLIC "-//XLIFF//DTD XLIFF//EN" "http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" xliff PUBLIC "-//XLIFF//DTD XLIFF//EN" "http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" - + Translation file. This file is distributed under the same license as the product package. Translation file. This file is distributed under the same license as the product package. - - This is the first time you've opened this editor for this project, so let's do a few checks... - This is the first time you've opened this editor for this project, so let's do a few checks... + + This is the first time you've opened the XLIFF editor for this project, or perhaps you've changed the target languages, so let's have a look... + This is the first time you've opened the XLIFF editor for this project, or perhaps you've changed the target languages, so let's have a look... - + The XLIFF standard requires us to determine a source language in which all strings are written. This language will be the reference language, from which all translations will be made. The other languages are referred to as target languages, and will be used for dialogues, warnings, printouts and so on. This is the language that will be used for the end user, according to your choice. Depending on the content of your project, the language of the system and the application, I've tried to determine the source and target languages. You can change the source language and add target languages if you wish. @@ -476,14 +476,26 @@ Depending on the content of your project, the language of the system and the app Depending on the content of your project, the language of the system and the application, I've tried to determine the source and target languages. You can change the source language and add target languages if you wish. - + Welcome to 4DPop XLIFF Pro Welcome to 4DPop XLIFF Pro - + LANGUAGES FOUND LANGUAGES FOUND + + AVAILABLE LANGUAGES + AVAILABLE LANGUAGES + + + The "{lang}" folder and its contents will be deleted. + The "{lang}" folder and its contents will be deleted. + + + Remove + Remove + @@ -504,6 +516,9 @@ Depending on the content of your project, the language of the system and the app + + + diff --git a/Resources/fr.lproj/Xliff Editor.xlf b/Resources/fr.lproj/Xliff Editor.xlf index 0ea2a38..4b50835 100755 --- a/Resources/fr.lproj/Xliff Editor.xlf +++ b/Resources/fr.lproj/Xliff Editor.xlf @@ -19,69 +19,69 @@ This file is distributed under the same license as the product package. - + Save Enregistrer - - Cancel - Annuler - - + + OK OK - + Yes Oui - + No Non - + New Nouveau - + Edition Édition - + Source Source - + Change… Changer… - + Make IDs unique Rendre les ID uniques - + + Cancel + Cancel + - + File name: Nom du fichier : - + Are you sure that you want to delete the group "{item}" ? Êtes-vous certain de vouloir supprimer le groupe "{item}" ? - + Are you sure that you want to delete the item "{item}" ? Êtes-vous certain de vouloir supprimer la ligne "{item}" ? - + Are you sure? Etes-vous certain ? - + Are you sure that you want to delete the file "{filename}"? Êtes-vous certain de vouloir supprimer le fichier "{filename}" ? - + The name "{name}" is already taken. Please choose a different name. @@ -89,7 +89,7 @@ Please choose a different name. Veuillez choisir un nom différent. - + The name must not be empty. Please enter a valid name. @@ -97,15 +97,15 @@ Please enter a valid name. Veuillez entrer un nom valide. - + Select the xliff file to import Sélectionnez le fichier xliff à importer - + Modifications are not allowed because the IDs are not unique Les modifications ne sont pas autorisées car les ID ne sont pas uniques - + The file {name} already exists. Do you want to replace it? @@ -113,7 +113,7 @@ Do you want to replace it? Voulez-vous le remplacer ? - + Making the IDs unique will prevent the old command "{command}" from being used. Changes will be saved and cannot be undone. @@ -121,375 +121,382 @@ Changes will be saved and cannot be undone. Les modifications seront enregistrées et ne pourront pas être annulées. - + I have understood well J'ai bien compris - + Unique IDs assignment failure Échec de l'attribution d'IDs uniques - + New file Nouveau fichier - + Add a group in the current file Ajouter un groupe au fichier courant - + Add a string to the current group Ajouter une chaine dans le groupe courant - + Current file's info Informations sur le fichier courant - + Preferences Préférences - + Switch between the editor and the pallet Bascule entre l'éditeur et la palette - + Show or Hide the string box Afficher ou masquer la chaîne - + Show or Hide the attributes box Afficher ou masquer la fenêtres des attributs - + XLIFF 1.0 Specification Spécification XLIFF 1.0 (Anglais) - + Short cuts for the current actions. Raccourcis pour les actions courantes. - + A multilingual XLIFF editor Un éditeur XLIFF multilingue - - Group - Groupe - - + + String Chaîne - - File - Fichier - - + + - + New File Nouveau fichier - + New Nouveau - + File... Fichier... - + Fill in Compléter - + Preferences… Préférences… - + Rename… Renommer… - + Delete.… Supprimer… - + File informations… Informations fichier… - + Add a group Ajouter un groupe - + Show on disk Montrer le fichier - + Validate using the DTD Valider à l'aide de la DTD - + Editor… Éditeur… - + Set reference value to all languages Définir la valeur de référence pour toutes les langues - + Prefix with the group name Préfixer avec le nom du groupe - + Add a comment Ajouter un commentaire - + Edit comment Modifier le commentaire - + Close comment Fermer le commentaire - + All Tous - + Operating Systems Systèmes d'exploitation - + Project Settings… Paramètres du projet… - + Import… Importer… - + XLIFF reference Référence XLIFF - + 4D Code Code 4D - + Resname Resname - + New Group Nouveau groupe - + New String Nouvelle Chaîne - + Duplicate Dupliquer - + Menu Menu - + Close Fermer - + Code for Code pour - + Window Fenêtre - + Find Chercher - + Find next Chercher suivant - + Xliff Editor Editeur Xliff - + Xliff - + Find... Chercher... - + Don't save Ne pas enregistrer - + Resources Folder Dossier ressources - + Default values Valeurs par défaut - + Use the database's folder Utiliser le dossier de la base - + Use the folder: Utiliser le dossier : - + Comments Commentaires - + Metal Window Aspect métal - + Languages Langues - + General Générale - + Database Base - + Attributes Attributs - + Values Valeurs - + Select the Target Resource Folder. Sélectionner le dossier ressource à éditer - + Use group's resname Utiliser le resname du groupe - + Use prefix: Utiliser le préfixe : - + Separating character: Caractère séparateur : - + Escaped characters Caractères échappés - + Maximum size of the resname Taille maxi du resname - + Advanced Avançé - + Files Fichiers - + Drag & drop in form: Glissé-déposé dans un formulaire : - + Styled text Texte stylé - + Localization Localisation - + Project Projet - + Languages Langues - + Reference Référence - + Localizations Localisations - + Filter Filtrer - + File Fichier - + xliff PUBLIC "-//XLIFF//DTD XLIFF//EN" "http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" - + Translation file. This file is distributed under the same license as the product package. - - This is the first time you've opened this editor for this project, so let's do a few checks... - C'est la première fois que vous ouvrez cet éditeur pour ce projet, faisons quelques vérifications... + + This is the first time you've opened the XLIFF editor for this project, or perhaps you've changed the target languages, so let's have a look... + C'est la première fois que vous ouvrez l'éditeur XLIFF pour ce projet, ou peut-être avez-vous changé les langues cibles, alors jetons un coup d'œil... - + The XLIFF standard requires us to determine a source language in which all strings are written. This language will be the reference language, from which all translations will be made. The other languages are referred to as target languages, and will be used for dialogues, warnings, printouts and so on. This is the language that will be used for the end user, according to your choice. Depending on the content of your project, the language of the system and the application, I've tried to determine the source and target languages. You can change the source language and add target languages if you wish. La norme XLIFF oblige à déterminer une langue source dans laquelle toutes les chaînes sont écrites. Cette langue sera la langue de référence, à partir de laquelle toutes les traductions seront effectuées. Les autres langues sont appelées langues cibles et seront utilisées pour les dialogues, les avertissements, les impressions, etc. C'est la langue qui sera utilisée pour l'utilisateur final, selon votre choix. En fonction du contenu de votre projet, de la langue du système et de l'application, j'ai essayé de déterminer la langue source et les langues cibles. Vous pouvez modifier la langue source et ajouter des langues cibles si vous le souhaitez. - + Welcome to 4DPop XLIFF Pro Bienvenue dans 4DPop XLIFF Pro - + LANGUAGES FOUND LANGUES TROUVÉES - + + AVAILABLE LANGUAGES + Le contenu du dossier {lang} sera supprimé + + + The "{lang}" folder and its contents will be deleted. + Le dossier "{lang}" et son contenu seront supprimés. + + + Remove + Supprimer + + + @@ -507,4 +514,7 @@ En fonction du contenu de votre projet, de la langue du système et de l'applica + + +