Reputation: 750
When building a VCD you define the languages like so:
<CommandSet xml:lang="en-US">
...
</CommandSet>
<CommandSet xml:lang="ja-JP">
...
</CommandSet>
My question is, if I want multiple languages to use the same CommandSet (such as en-US
and en-GB
) is that possible without copy/paste?
Upvotes: 3
Views: 775
Reputation: 1306
This is no longer possible. With WP8.1 you MUST supply the xml:lang.
Upvotes: 0
Reputation: 16092
EDIT: The option listed in this answer doesn't work. It seems the best way to avoid VCD multi-langage copy-paste is to use T4 templates to generate VCDs are compile time.
Yep, that's actually pretty simple. As long as you don't have CommandSets overlapping you can create a CommandSet for the entire language without mentioning a specific region. Remember, xml:lang
is a generic XML attribute and you can use that to your advantage.
In the code snippet below we'll specify an en
(English) voice command set without the need to mention specific regions.
<?xml version="1.0" encoding="utf-8"?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.0">
<CommandSet xml:lang="en">
<Example> English example </Example>
<!-- ... -->
</CommandSet>
<CommandSet xml:lang="es-ES">
<Example> Non-english example </Example>
<!-- ... -->
</CommandSet>
</VoiceCommands>
When we run this code snippet we can see the different Example text showing up in different emulators:
One limitation here is that you can't have a xml:lang="en"
CommandSet at the same time as region specific english CommandSets (e.g. xml:lang="en-us"
). For the overwhelming majority of apps, that's fine. If you're however embedding a region specific PhraseList you'll have to use alternative strategies (e.g. list of movies only available in specific regions due to copyright restrictions) . One option I've seen before is a T4 template generating a VCD file instead of having a repetitive copy-paste VCD file.
Upvotes: 2