Although the metadata route would work, there is a simpler way:
Add a local variable to your process and call it formTemplate or langTemplate (or any other name of your choice)
Add a Run Script action (JavaScript or VBScript) which then sets the value of your local variable formTemplate based on the value of languageCode (which you can get from data selection)
It would be interesting to see what your script looks like. Can you paste it here?
The Watch.ExpandString method should enable you to perform data selection directly from the data file.
Now if you are saying that each record in your data mapper may potentially use a different template (either for language1 or language2), then you will need to use the Metadata Sequencer to split it on the Document level. Then use Set Job Info and variables to then set the value of %{languageCode } from Metadata Location. This approach, in my opinion, can be very slow expecially if you have thousands of records.
So if there is a need to change template based on value of language code in your data mapper and that its value isn’t the same throughout the records for the same data file, then perhaps a better approach would be to create two sections in your template: one section for language 1 and the other for language 2. Then simply right click on the sections and select Make Conditional (v1.8+) to enable or disable the sections based on the value of languageCode in your data mapper. Then you will not need to design two templates, create metadata(if not necessary for any other task) or split it; and the process in Workflow will be simpler and much faster.
Alternatively, you may also want to take a look at the following Single Script Translation guide:
Do you need to do any more processing before it goes to the language templates?
What I have done in the past is used the datamapper to get all the data required for the template (including the language) then have created 1 template with 2 different sections (Language 1 and language 2).
You can then set a control script to identify which language you want shown for each template. (script can make both invisible initially, if field = Language1 then Section 1 visible, if field==language2 then Section 2 is visible).
Assuming the majority of the rest of the file is the same, this does mean in the future you can make 1 change to the master page and both sections will change their formatting. This makes administration significantly easier!
In WORKFLOW, to dynamically access the value of a Metadata field, simply right-click anywhere that accepts a dyamic value (usually indicated by that field have a dark red label), and select “Get Metadata Location”. This will get the value of the field, at run time. You can assign it to a Watch variable, or use it in a Text Condition, for example.
So to directly answer your question, after the Execute Data Mapping, with “Output Records in Metadata” checked, you’d do a Text Condition to test the metadata (Get Metadata Location) against a language code, and then on one branch use one template, in the other, the other template.
However, I suggest that you could do this in Connect Designer, by having each language in it’s own Print Section, and make the Print Section conditional based on the language field in your Data Map. I’ve done all our multi-language templates this way.
I have managed it in the way of suggestion from Cbos, that works fine for us and accelerated our workflow.
Finally, a few words about our solution we built on Monday.
?We have now only one template for an invoice or delivery note, with a section for each language, which gets checked with information we get from the mapping (section.enable = true or false).
In my opinion this is the easiest way, and we do not need any variables in the workflow, and can do all decisions within the designer.