Xamarin RESX Import / Export for Mobile

Using the RESX file format to import/export content from/to your Xamarin projects

Within the Localize dashboard, we provide you with the ability to import and export phrases and translations in various file formats.

Importing / Exporting

To see a general explanation of how importing and exporting works in Localize, click here. Be sure to adhere to the file requirements below so that Localize will be able to successfully read your files.

File Requirements

🚧

UTF-8 Character Encoding

Be sure that you are using the UTF-8 character encoding when working with the external files you are creating for importing purposes, so that special characters like accents are encoded properly.

The following are the minimum requirements for the XAMARIN RESX file format.

🚧

Use XAMARIN RESX

Be sure to select the "XAMARIN RESX" file type instead of the "RESX" file type, since they use a different syntax.

The following header data is required for the file:

  • <?xml version="1.0" encoding="utf-8"?>
  • <root> - the root node
  • <data> - at least 1 data node is required

The following header data is optional for the file:

  • <schema> - the schema node is optional as seen in the example below
  • <resheader> - the resheader nodes are optional

The data nodes use this syntax:

<data name="PHRASE_KEY">
  <value>Source phrase or translation</value>
</data>
  • The name attribute is the phrase key, which is common across all languages files.
  • The <value> node contains either the source phrase or the corresponding translation of the phrase

Example English source language file:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <data name="happy-with-localize">
    <value>We’re happy that we chose Localize for our localization efforts!</value>
  </data>
  <data name="what-we-do">
    <value>What we do | Localize — LZ Product Demo</value>
  </data>
  <data name="partners-are-important">
    <value>Our partners are so important and we accomplish a lot together.</value>
  </data>
  <data name="no-irrigation-possible">
    <value>We can’t possibly run irrigation to this tree, so it will have to survive on its own.</value>
  </data>
  <data name="land-conservation">
    <value>We conserve land through outreach, restoration, and research.</value>
  </data>
</root>

Example Spanish target language file:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <data name="happy-with-localize">
    <value>¡Estamos contentos de haber elegido Localize para nuestros esfuerzos de localización!</value>
  </data>
  <data name="what-we-do">
    <value>Lo que hacemos | Localize - LZ Product Demo</value>
  </data>
  <data name="partners-are-important">
    <value>Nuestros socios son muy importantes y logramos mucho juntos.</value>
  </data>
  <data name="no-irrigation-possible">
    <value>No es posible que podamos regar este árbol, por lo que tendrá que sobrevivir por sí solo.</value>
  </data>
  <data name="land-conservation">
    <value>Conservamos la tierra mediante divulgación, restauración e investigación.</value>
  </data>
</root>

Example Spanish file as exported from the Localize dashboard:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by Localizejs.com App Localization -->
<root>
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
  <xsd:complexType>
    <xsd:choice maxOccurs="unbounded">
      <xsd:element name="metadata">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="value" type="xsd:string" minOccurs="0" />
          </xsd:sequence>
          <xsd:attribute name="name" use="required" type="xsd:string" />
          <xsd:attribute name="type" type="xsd:string" />
          <xsd:attribute name="mimetype" type="xsd:string" />
          <xsd:attribute ref="xml:space" />
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="assembly">
        <xsd:complexType>
          <xsd:attribute name="alias" type="xsd:string" />
          <xsd:attribute name="name" type="xsd:string" />
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="data">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
            <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
          </xsd:sequence>
          <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
          <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
          <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
          <xsd:attribute ref="xml:space" />
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="resheader">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
          </xsd:sequence>
          <xsd:attribute name="name" type="xsd:string" use="required" />
        </xsd:complexType>
      </xsd:element>
    </xsd:choice>
  </xsd:complexType>
</xsd:element>
</xsd:schema>
  <resheader name="resmimetype">
  <value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
  <value>2.0</value>
</resheader>
<resheader name="reader">
  <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
  <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> 
  <data name="land-conservation" xml:space="preserve">
  <value>Conservamos la tierra mediante divulgación, restauración e investigación.</value>
</data>
<data name="no-irrigation-possible" xml:space="preserve">
  <value>No es posible que podamos regar este árbol, por lo que tendrá que sobrevivir por sí solo.</value>
</data>
<data name="partners-are-important" xml:space="preserve">
  <value>Nuestros socios son muy importantes y logramos mucho juntos.</value>
</data>
<data name="what-we-do" xml:space="preserve">
  <value>Lo que hacemos | Localize - LZ Product Demo</value>
</data>
<data name="happy-with-localize" xml:space="preserve">
  <value>¡Estamos contentos de haber elegido Localize para nuestros esfuerzos de localización!</value>
</data>
</root>

Troubleshooting

If your import fails you will see a message on screen after the failure occurs. Or you can view the error here under Import History.


Did this page help you?