Skip to content

Commit

Permalink
Fix single-quoted strings
Browse files Browse the repository at this point in the history
In JOSM ' is a special character, so to print an actual ', you have to use ''. In Osmose, the character is not special.

In order to not get strange translations (such as
> unusual value of width: use '' for foot and " for inches, no spaces
instead of
> unusual value of width: use ' for foot and " for inches, no spaces
) we have to convert '' to '. This is necessary as the translated strings obtained from JOSM contain the double '' where ' should be the output.
  • Loading branch information
Famlam authored and frodrigo committed Aug 19, 2023
1 parent f849c44 commit 641a462
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mapcss/mapcss_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,10 @@ def JOSM_search(string):
# translate from English to the current language (only for strings in the JOSM user interface) [since 6506]
def tr(string, *args):
if string is not None:
return T_(string, *args)
# Treat '' as ' so JOSM translations work in Osmose too.
# A ' is a special character in JOSM, see https://josm.openstreetmap.de/wiki/Translations
t = T_(string, *args)
return {k: t[k].replace("''", "'") for k in t.keys()}

#regexp_test(regexp, string)
# test if string matches pattern regexp [since 5699]
Expand Down

0 comments on commit 641a462

Please sign in to comment.