Skip to content

Preset XML format

Pavel Melnikov edited this page Jul 28, 2013 · 6 revisions
<preset name="Test preset" lang="ru">
  <button label="продукты" icon="shop_convenience" directional="yes">
    <poi type="shop_convenience" />
  </button>
  <button label="свет" toggle="yes">
    <poi type="lit" />
    <properties>
      <property name="у дороги" k="near_road" type="boolean" />
    </properties>
  </button>
  <button label="Н.П.">
    <poi type="city_limit" />
    <properties>
      <property name="фон" k="colour:back" type="choice">
        <variant name="белый" v="white" />
        <variant name="синий" v="blue" />
      </property>
    </properties>
  </button>
  <button label="км столб" icon="highway_milestone">
    <poi type="milestone" />
    <properties>
      <property name="км" k="pk" type="sequence" />
      <property name="обр.км" k="pk:back" type="sequence" />
    </properties>
  </button>
</preset>

Localization

In the first version of implementation, lang attribute in preset tag specifies the language of this preset, i.e., language for attributes that are displayed to the user in the application. These localized values are:

  • name attribute for preset tag
  • label attribute for button
  • name attribute of property tag
  • name attribute of variant tag

In Android world, there is different approach to localization. That is, many languages can be bundled into application so that the app can be used internationally. With this universality in mind, I introduce second localization scheme for preset file (in addition to first).

Attributes mentioned above can have language specifiers on their own, and many such attributes can co-exists in a single tag.

Example: <button label="Exit" label:de="Ausgang" label:ru="Съезд">

When user launches an application, is will load string according to system locale setting, and will use default (attribute without specifier) value if no attribute match current system language.

Clone this wiki locally