If you reference XF inside template structure and create XF structure exactly similar to site structure, the pages will pick the localised XF based on the current site page being accessed.This is especially useful for implementing localised header and footer configured via XF’s.
For example if /content/demo/us/en pages are referenced it will pick the /content/experience-fragments/demo/us/en XF on the fly.
For Localised XF header and footer to work the XF need to be included in the template structure. The XF path inside template should be for language master.
The XF structure should be exactly similar to that of site structure as shown below.
i.e. nodes names below /content and /content/experience-fragments should be same till language node.
Site - /content/demo/language-master/en
XF - /content/experience-fragments/demo/language-masters/en