2021-11-19, 14:38
Hello, I want to add to my new addon a list of country selection. For this I have this:
Where the label in <options> is the local translation of the country name.
The question is: Can I somehow sort the options in that list according to the labels, so that the names of the countries translated in the interface language appear in alphabetical order?
xml:<setting id="region_code" type="string" label="30035" help="">
<level>0</level>
<default>ES</default>
<constraints>
<options>
<option label="30200">DZ</option>
<option label="30201">AR</option>
<option label="30202">AU</option>
<option label="30203">AT</option>
<option label="30204">AZ</option>
<option label="30205">BH</option>
<option label="30206">BD</option>
...
<option label="30303">VE</option>
<option label="30304">VN</option>
<option label="30305">YE</option>
<option label="30306">ZW</option>
</options>
</constraints>
<control type="list" format="string">
<heading>"30035"</heading>
</control>
</setting>
Where the label in <options> is the local translation of the country name.
The question is: Can I somehow sort the options in that list according to the labels, so that the names of the countries translated in the interface language appear in alphabetical order?