#QUALITY by cg draft
authorClaus Gittinger <cg@exept.de>
Thu, 20 Sep 2018 11:34:44 +0200
changeset 3595 ebf63823c259
parent 3594 cfbc0a29b030
child 3596 655aee5986be
#QUALITY by cg class: Tools::InternationalLanguageTranslationEditor changed: #readResourceFile:asLanguage:
Tools__InternationalLanguageTranslationEditor.st
--- a/Tools__InternationalLanguageTranslationEditor.st	Sat Sep 15 12:43:15 2018 +0200
+++ b/Tools__InternationalLanguageTranslationEditor.st	Thu Sep 20 11:34:44 2018 +0200
@@ -2711,36 +2711,44 @@
 !
 
 readResourceFile:aFilename asLanguage:lang
-    |resourcePack inStream lineString encoding decoder sortedKeys remainingKeys|
+    |resourcePack inStream lineString encoding 
+     decoder sortedKeys remainingKeys lineNr|
 
     aFilename exists ifFalse:[
-	Dialog information:(resources string:'Language file: "%1" does not exist' with:aFilename baseName).
-	^ self
+        Dialog information:(resources string:'Language file: "%1" does not exist' with:aFilename baseName).
+        ^ self
     ].
 
     resourcePack := ResourcePack new.
 
-    inStream := aFilename readStream.
+    inStream := LineNumberReadStream on:(aFilename readStream).
     [inStream atEnd] whileFalse:[
-	lineString := inStream nextLine.
-	(lineString notEmpty
-	and:[ (lineString startsWith:';') not and:[ (lineString startsWith:'"/') not]]) ifTrue:[
-	    ((lineString startsWith:'#') and:[(lineString startsWith:'#(') not]) ifTrue:[
-		lineString := (lineString copyFrom:2) withoutSeparators.
-		(lineString startsWith:'encoding ') ifTrue:[
-		    encoding := ResourcePack extractEncodingFromLine:lineString.
-		    decoder := CharacterEncoder encoderFor:encoding ifAbsent:nil.
-		].
-	    ] ifFalse:[
-		ResourcePack
-		    processResourceLine:lineString
-		    encoding:decoder
-		    file:aFilename pathName
-		    printErrorWith:[:msg | Transcript showCR:msg ]
-		    for:resourcePack
-		    keepUselessTranslations:true.
-	    ].
-	].
+        lineNr := inStream lineNumber.
+        lineString := inStream nextLine.
+        (lineString notEmpty
+        and:[ (lineString startsWith:';') not and:[ (lineString startsWith:'"/') not]]) ifTrue:[
+            ((lineString startsWith:'#') and:[(lineString startsWith:'#(') not]) ifTrue:[
+                lineString := (lineString copyFrom:2) withoutSeparators.
+                (lineString startsWith:'encoding ') ifTrue:[
+                    encoding := ResourcePack extractEncodingFromLine:lineString.
+                    decoder := CharacterEncoder encoderFor:encoding ifAbsent:nil.
+                ].
+            ] ifFalse:[
+                ResourcePack
+                    processResourceLine:lineString
+                    encoding:decoder
+                    file:aFilename pathName
+                    printErrorWith:[:msg | 
+                        Transcript 
+                            showCR:'%1[%2]: %3'
+                            with:(aFilename baseName)
+                            with:lineNr
+                            with:msg
+                    ]
+                    for:resourcePack
+                    keepUselessTranslations:true.
+            ].
+        ].
     ].
     inStream close.
 
@@ -2751,12 +2759,14 @@
     keyStringsToLanguageMappings atLanguage: lang putEncoder: decoder.
 
     sortedKeys do:[:k |
-	keyStringsToLanguageMappings at:k language:lang put:(resourcePack at:k) sendChange:false
+        keyStringsToLanguageMappings at:k language:lang put:(resourcePack at:k) sendChange:false
     ].
     remainingKeys do:[:k |
-	keyStringsToLanguageMappings at:k language:lang put:(resourcePack at:k) sendChange:false
+        keyStringsToLanguageMappings at:k language:lang put:(resourcePack at:k) sendChange:false
     ].
     keyStringsToLanguageMappings changed.
+
+    "Modified: / 20-09-2018 / 11:09:39 / Claus Gittinger"
 !
 
 saveLanguage: lang