Fix more 'Lint/ShadowingOuterLocalVar' warnings reported by ameba

This commit is contained in:
Samantaz Fox
2022-01-20 17:17:22 +01:00
parent 1c91110464
commit 12b818a83c
10 changed files with 22 additions and 18 deletions

View File

@@ -94,8 +94,8 @@ def translate(locale : String?, key : String, text : String | Nil = nil) : Strin
translation = ""
match_length = 0
raw_data.as_h.each do |key, value|
if md = text.try &.match(/#{key}/)
raw_data.as_h.each do |hash_key, value|
if md = text.try &.match(/#{hash_key}/)
if md[0].size >= match_length
translation = value.as_s
match_length = md[0].size