Skip to content

Commit

Permalink
deal with some edge case and better create model format
Browse files Browse the repository at this point in the history
  • Loading branch information
badetitou committed Feb 27, 2023
1 parent 410b751 commit 54c82f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ CS18NPropertiesExporterTest >> testExportValueWithNamedAttribute [
entry: entry;
yourself.
value addValueVariable: (CS18NValueVariable new
name: '{label}';
name: 'label';
startPos: 7;
endPos: 13;
yourself).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ CS18NPropertiesExporter >> constructValueString: aCS18NValue [

| string |
string := aCS18NValue name copyReplaceAll: '[%]' with: '{{ noname }}'.
aCS18NValue valueVariables do: [ :valueVariable |
valueVariable name = 'noname' ifFalse: [
string := '{{ ' , valueVariable name allButFirst allButLast , ' }}'
join: (string splitOn: valueVariable name) ] ].

aCS18NValue valueVariables ifNotNil: [
| col |
col := aCS18NValue valueVariables select: [ :var |
var name ~= 'noname' ].
col ifNotEmpty: [
| dic |
dic := Dictionary new.
col do: [ :var | dic at: var name put: '{{ ' , var name , ' }}' ].
string := string format: dic ] ].
^ string
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ CS18NPropertiesImporter >> extractModelValueAttributes: aModelValue [
name: 'noname';
yourself) ].
rangesRegEx := aModelValue name allRangesOfRegexMatches: '{[^}]*}'.
rangesRegEx do: [ :range |
rangesRegEx do: [ :range |
attributes add: (CS18NValueVariable new
startPos: range first;
endPos: range last;
Expand Down

0 comments on commit 54c82f4

Please sign in to comment.