I'm trying to make a cross platform string management system, for both iOS and Android app (so I don't have to translate both app and I reuse string from one app into the other).
For this, I use the following flow :
XML storing cross platform string identifiers (with potentially attributes like comment
or iOS-only
, ...)
<!-- identifiers.xml -->
<identifiers>
<id>button_signin_facebook</id>
<id ios-only="true">button_signin_apple</id>
...
</identifiers>
And then I have N translations for the N supported languages :
<!-- translation_en.xml -->
<translation lang="en">
<string id="button_signin_facebook">Continue with Facebook</string>
<string id="button_signin_apple">Continue with Apple ID</string>
...
</translation>
A PHP script processes all of this and generate all translation files for both platform, after verifying integrity (see if some string are unused, see if we have created a string twice etc.)
Now my question is :
How to make a XSD for the translation_lang.xml
files enforcing that the id
attribute of string
elements is a "enumeration" (or "reference" ?) from all the id
in the identifiers.xml
file ? (just like a foreign key in a database)
I'm new to XSD, and I found that I could make enumeration in XSD, but it's not what I want. (The identifiers values needs to be in the XML file identifiers.xml and not in a schema, because they are not fixed.)
XSD cannot express constraints between separate XML documents.
Alternative possibilities: