Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelachaux committed Jan 22, 2025
1 parent bfc4d17 commit 38b148c
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 269 deletions.
19 changes: 19 additions & 0 deletions Project/Sources/Classes/Xliff.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -630,13 +631,25 @@ 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()

If ($o#Null:C1517)

$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)
Expand All @@ -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
Expand Down
10 changes: 7 additions & 3 deletions Project/Sources/Classes/_WIZARD_Controller.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 📦
Expand Down Expand Up @@ -121,7 +125,8 @@ Function doSelectSourceLanguage()

End for each

$menu.line()
$menu.line()\
.append(Localized string:C991("availableLanguages")).disable()

End if

Expand Down Expand Up @@ -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

Expand Down
60 changes: 30 additions & 30 deletions Project/Sources/Forms/WIZARD/form.4DForm
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -45,8 +45,8 @@
"Text8": {
"type": "text",
"text": ".Source language:",
"top": 249,
"left": 72,
"top": 269,
"left": 47,
"width": 180,
"height": 16,
"fontTheme": "normal",
Expand All @@ -55,8 +55,8 @@
},
"source": {
"type": "button",
"top": 249,
"left": 301,
"top": 269,
"left": 276,
"width": 266,
"height": 17,
"events": [
Expand All @@ -71,8 +71,8 @@
},
"List Box": {
"type": "listbox",
"left": 262,
"top": 275,
"left": 237,
"top": 295,
"width": 307,
"height": 209,
"events": [
Expand All @@ -84,7 +84,7 @@
"verticalLineStroke": "transparent",
"fill": "transparent",
"scrollbarVertical": "automatic",
"right": 569,
"right": 544,
"sizingY": "grow",
"currentItemSource": "formGetInstance.targets.item",
"currentItemPositionSource": "formGetInstance.targets.itemPosition",
Expand Down Expand Up @@ -125,17 +125,17 @@
"Text2": {
"type": "text",
"text": ".Target languages:",
"top": 283,
"left": 83,
"top": 303,
"left": 58,
"width": 169,
"height": 16,
"textAlign": "right",
"fontWeight": "bold"
},
"Button3": {
"type": "button",
"top": 489,
"left": 262,
"top": 509,
"left": 237,
"width": 16,
"height": 16,
"events": [
Expand All @@ -148,8 +148,8 @@
},
"Button4": {
"type": "button",
"top": 489,
"left": 284,
"top": 509,
"left": 259,
"width": 16,
"height": 16,
"events": [
Expand All @@ -162,8 +162,8 @@
},
"Line2": {
"type": "line",
"top": 484,
"left": 261,
"top": 504,
"left": 236,
"width": 308,
"height": 0,
"sizingY": "move"
Expand All @@ -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": [
Expand All @@ -194,8 +194,8 @@
"Button5": {
"type": "button",
"text": ":xliff:CancelButton",
"top": 527,
"left": 449,
"top": 547,
"left": 424,
"width": 81,
"height": 29,
"events": [
Expand All @@ -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",
Expand All @@ -230,7 +230,7 @@
},
"method": "formMethod",
"windowSizingX": "fixed",
"rightMargin": 0,
"rightMargin": 20,
"bottomMargin": 20,
"windowMinHeight": 500
}
19 changes: 17 additions & 2 deletions Project/Sources/Methods/EDITOR OPEN.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -60,4 +75,4 @@ Else

CALL WORKER:C1389($name; Current method name:C684; True:C214)

End if
End if
4 changes: 2 additions & 2 deletions Project/Sources/folders.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"groups": [
"_UPDATES",
"EDITOR",
"Wizard"
"WIZARD"
],
"classes": [
"_Editor"
Expand Down Expand Up @@ -163,7 +163,7 @@
"WRAP_AROUND"
]
},
"Wizard": {
"WIZARD": {
"forms": [
"WIZARD"
],
Expand Down
Loading

0 comments on commit 38b148c

Please sign in to comment.