Skip to content

Commit

Permalink
Adjusted conversion to xcstrings
Browse files Browse the repository at this point in the history
Adjusted the conversion because missing localizations would display as empty strings instead of key placeholders
  • Loading branch information
Jag-Marcel committed Jun 3, 2024
1 parent 811fe13 commit 3de1788
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions Scribe-i18n/Scripts/convert_to_swift.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,17 @@
translation = (langfile[key]["translation"]
.replace('"', '\\"')
.replace('\n', '\\n'))
if translation == '':
state = ''
else:
state = 'translated'
data += (f' "{lang}" : {{\n'
f' "stringUnit" : {{\n'
f' "state" : "{state}",\n'
f' "value" : "{translation}"\n'
f' }}\n'
f' }}')
if lang != langlist[len(langlist) - 1]:
data += ',\n'
else:
data += '\n'
if translation != '':
data += (f' "{lang}" : {{\n'
f' "stringUnit" : {{\n'
f' "state" : "translated",\n'
f' "value" : "{translation}"\n'
f' }}\n'
f' }}')
if lang != langlist[len(langlist) - 1]:
data += ',\n'
else:
data += '\n'

if pos < len(file):
data += (' }\n'
Expand Down

0 comments on commit 3de1788

Please sign in to comment.