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:
- Is there a better/general approach how I can teach my translators how to write placeholders?
- How can I write my check based on the file format (or translation file suffix, i.e .xml, .strings)? So I know, this is an android/xml file, and the placeholder should be
%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