#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Sat, 17 Aug 2019 21:50:26 +0200
changeset 8779 632b56b92513
parent 8778 3e61d4b4248d
child 8780 9c30aa0905ee
#FEATURE by exept class: ResourcePack changed: #stringWithCRs: #stringWithCRs:withArguments:
ResourcePack.st
--- a/ResourcePack.st	Fri Aug 16 01:13:35 2019 +0200
+++ b/ResourcePack.st	Sat Aug 17 21:50:26 2019 +0200
@@ -1411,13 +1411,7 @@
     "translate (retrieve) a string - if not present, return s.
      replaces \'s with CRs"
 
-    (s startsWith:':c:') ifTrue:[
-        ^ (self string:(s withoutPrefix:':c:')) withoutCEscapes
-    ].    
-    (s startsWith:':st:') ifTrue:[
-        ^ (self string:(s withoutPrefix:':st:')) expandPlaceholdersWith:nil
-    ].    
-    ^ (self string:s) withCRs
+    ^ self stringWithCRs:s withArguments:#()
 
     "
      NewLauncher classResources
@@ -1518,18 +1512,32 @@
 stringWithCRs:s withArguments:argArray
     "translate, replace \'s with CRs and finally expand args.
      CR-replacement is done before args are inserted
-     i.e. if any arg contains a backslash (DOS filenames), those are not translated."
+     i.e. if any arg contains a backslash (DOS filenames), those are not translated.
+     If there is no xlation for the whole string,
+     try xlations for individual line."
 
-    |template|
+    |xlation collectedXLations|
 
-    template := self at:s ifAbsent:s.
     (s startsWith:':c:') ifTrue:[
         ^ (self string:(s withoutPrefix:':c:')) withoutCEscapes expandPlaceholdersWith:argArray
     ].    
     (s startsWith:':st:') ifTrue:[
         ^ (self string:(s withoutPrefix:':st:')) expandPlaceholdersWith:argArray
     ].    
-    ^ template withCRs expandPlaceholdersWith:argArray.
+    xlation := self at:s ifAbsent:nil.
+    xlation notNil ifTrue:[
+        ^ xlation withCRs expandPlaceholdersWith:argArray.
+    ].
+    "/ try individual lines...
+    collectedXLations := s withCRs asStringCollection 
+        collect:[:eachLine | self string:eachLine withArguments:argArray].
+    ^ collectedXLations asStringWithoutFinalCR
+
+    "
+     stx_libview classResources string:'Copy\Paste'         
+     stx_libview classResources stringWithCRs:'Copy\Paste' 
+     stx_libtool classResources stringWithCRs:'copy\paste' 
+    "
 
     "Created: / 09-08-2018 / 14:54:16 / Claus Gittinger"
     "Modified: / 07-09-2018 / 12:44:06 / Claus Gittinger"