We use Weblate in our mobile app CI environment. So far everything is awesome. Weblate runs in a docker environment (v4.1)
Now I want to improve the workflow.
I managed to create custom checks, these validate the use of Android/iOS placeholders (see sample below). Now the translator needs to know which platform he is working with to use the correct placeholder and dismiss the false-positive check.
Placeholder in use right now are %1$@
for iOS and %1$s
for Android
My question:
%1$s
NOT %1$@
Sample check
class iOSPlaceholderCheck(TargetCheck):
# Used as identifier for check, should be unique
# Has to be shorter than 50 characters
check_id = "iOSPlaceholder"
# Short name used to display failing check
name = _("iOS placeholder")
# Description for failing check
description = _("Your translation contains an iOS placeholder")
# Real check code
def check_single(self, source, target, unit):
if "%1$@" in target:
return True
...
thanks in advance
I can see few approaches:
if "%1$@" not in source:
return False
return "%1$@" not in target