LRM resx Support
The .resx resource file format consists of XML entries, which specify objects and strings inside XML tags. LRM supports .resx files. See https://msdn.microsoft.com/en-us/library/ekyft91f(v=vs.100).aspx .
Contents
Locale File Extensions
- The resx files follow this naming convention: filename.<language>.resx or filename.<language>-<country>.resx. For example, resources.resx or resources.en.resx for a base file, resources.fr.resx or resources.fr-FR.resx, etc.
- If you can, avoid duplicate file names. Duplications incur more prep kits than necessary.
What is resx files encoding?
.Net resx files must be UTF-8 encoded, as per the resx schema, Hence, on-boarding resx resource files with LRM must specify the UTF-8 encoding:
<?xml version="1.0" encoding="utf-8"?> <root> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> </xsd:complexType> </xsd:element>
Example of .resx Files
<?xml version="1.0" encoding="UTF-8"?> <root> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"> <xsd:element msdata:IsDataSet="true" name="root"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string" /> <xsd:element minOccurs="0" msdata:Ordinal="2" name="comment" type="xsd:string" /> </xsd:sequence> <xsd:attribute msdata:Ordinal="1" name="name" type="xsd:string" /> <xsd:attribute msdata:Ordinal="3" name="type" type="xsd:string" /> <xsd:attribute msdata:Ordinal="4" name="mimetype" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string" /> </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>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="CARO_CAROPTI_100" xml:space="preserve"><value>Car Option</value></data> <data name="COMM_THISSHO_1" xml:space="preserve"><value>this should be detected</value></data> </root>
Sample LRM Project Definition File for .resx
<?xml version="1.0" encoding="UTF-8"?> <lrmconf> <model-version>1.0.0</model-version> <project-name>WinApp</project-name> <project-desc>Lingoport.WinApp is configured to support resx resource files</project-desc> <group-name>Lingoport</group-name> <top-level-dir>/var/lib/jenkins/jobs/Lingoport.WinApp/workspace</top-level-dir> <detect-errors> <missed-trans-error>1</missed-trans-error> <parameter-mismatch-error>1</parameter-mismatch-error> </detect-errors> <track-back-locale>br</track-back-locale> <pseudo-locale>eo</pseudo-locale> <target-locales> <locale>de</locale> <locale>fr</locale> <locale>ja</locale> </target-locales> <default-locale>en_US</default-locale> <resource-extensions> <resource-extension> <!-- parser-type not needed since .resx is a standard LRM extension that maps to the xml parser type --> <extension>resx</extension> <file-name-pattern>*.l-c-v</file-name-pattern> <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale> <file-location-pattern></file-location-pattern> <use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale> <base-file-encoding>UTF-8</base-file-encoding> <localized-file-encoding>UTF-8</localized-file-encoding> <parameter-regex-pattern><![CDATA[%[ds]|%\d+\$[ds]|%\{\w+\}]]></parameter-regex-pattern> </resource-extension> <resource-extension> <!-- parser-type is required because .myext is not a standard LRM extension --> <extension>myext</extension> <!-- Once the project is created, the ResxParser.xml, located in the samples/XmlParserExamples, needs to copied over the project's config folder and renamed xmlParser.xml --> <parser-type>xml</parser-type> <file-name-pattern>*.l-c-v</file-name-pattern> <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale> <file-location-pattern></file-location-pattern> <use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale> <base-file-encoding>UTF-8</base-file-encoding> <localized-file-encoding>UTF-8</localized-file-encoding> <parameter-regex-pattern><![CDATA[%[ds]|%\d+\$[ds]|%\{\w+\}]]></parameter-regex-pattern> </resource-extension> </resource-extensions> <dirset> <includes> <include-dir>**/**</include-dir> </includes> <excludes> <exclude-dir-file>**/source/bin/**</exclude-dir-file> </excludes> </dirset> </lrmconf>