Difference between revisions of "LRM rc Support"

From Lingoport Wiki
Jump to: navigation, search
(Example Project Definition File)
(valid rc syntax)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Example .rc file ==
+
== Example .rc file or a file extension that uses the ''rc'' parser type ==
 
<pre>
 
<pre>
 
// Microsoft Visual C++ generated resource script.
 
// Microsoft Visual C++ generated resource script.
Line 88: Line 88:
 
</pre>
 
</pre>
   
== Example Project Definition File ==
+
== ''rc'' parser type ==
  +
=== valid rc syntax ===
<?xml version="1.0" encoding="UTF-8"?>
 
  +
Files that use the ''rc'' parser are expected to have valid rc syntax.
<lrmconf>
 
  +
Key and corresponding value must be on the same line.
<model-version>2.0.11</model-version>
 
  +
<!--Group name must match the group name option -->
 
  +
=== .rc uses the ''rc'' parser type===
<group-name>acme</group-name>
 
  +
When defining a project containing LRM Standard '''.rc''' extension resource files, there is no need to define a ''&lt;parser-type&gt;'' as the ''rc'' parser will always be used.
<project-name>DemoRc</project-name>
 
  +
=== unique file extension needs to define ''rc'' parser type ===
<project-desc>This is a sample LRM Project definition file, configured to support RC properties files</project-desc>
 
  +
If a unique file extension is a valid .rc file, then the ''&lt;parser-type&gt;'' should be ''rc'' in the project definition file.
<!-- Example, linux -->
 
  +
<!--<top-level-dir>/var/lib/job/workspace/acme/source</top-level-dir>-->
 
  +
== Example of Project Definition for Resources ==
<!-- Example, windows -->
 
  +
The following is an example of rc resource file definitions. See [[Supported_Resource_Bundles#Resource_Extensions| resource extensions]] for more information.
<top-level-dir>C:\acme\source</top-level-dir>
 
  +
<detect-errors>
 
<!-- if set to '0' (false), then the 'missed translation' error will not be triggered
 
if the non-base file has the same text as the base file.
 
Missed Translation error will still occur if the base file has a different key or if
 
the base file has changed since it was last prepped. -->
 
<missed-trans-error>0</missed-trans-error>
 
<parameter-mismatch-error>1</parameter-mismatch-error>
 
</detect-errors>
 
<!--If you wish to create Track Back resource files, enter the Track Back locale such as `br`-->
 
<!--The track back locale is mutually exclusive of the base (default) locale, target locales and pseudo-locale-->
 
<track-back-locale>br</track-back-locale>
 
<!--If you wish to pseudo-localized your files enter a pseudo-locale-->
 
<!--The pseudo-locale is mutually exclusive of the base (default) locale and target locales-->
 
<pseudo-locale>eo</pseudo-locale>
 
<!--Target locales are the locales where the corresponding resource files will be translated. -->
 
<!--These target locales are mutually exclusive of the default locale-->
 
<target-locales> <!-- set which locales are targeted for translation. -->
 
<locale>fr_FR</locale> <!-- French for France -->
 
<locale>fr_CA</locale> <!-- French Canadian -->
 
<locale>es_MX</locale>
 
</target-locales>
 
<!--Default locale is the base locale. This is the locale where corresponding resource files will not be translated.-->
 
<!--The default locale is mutually exclusive of the target locales-->
 
<default-locale>en_US</default-locale> <!-- delineates which locale to translate from -->
 
 
<resources-extensions>
 
<resources-extensions>
<!-- although only 1 resource extension is present in this file,
 
kits support multiple resource extensions. This necessitates both a
 
"<resource-extensions>" and "<resource-extension>" tag -->
 
<!--The file-name-pattern and/or file-location-pattern indicate the pattern of the-->
 
<!--localized file names (file-name-pattern) and the localized folder names (file-location-pattern).-->
 
<!--If the names contain the locale then a pattern of 1,c and v will be used.-->
 
<!--If the names contain the Locale ID then LCID will be used.-->
 
<!--Example pattern using locale-->
 
<!-- If your localized resource files use their locale in their names then the locale pattern will-->
 
<!-- be used where l stands for language; c for country; v for variant; and the characters between-->
 
<!-- are used as the separator characters.-->
 
<!-- <file-name-pattern>*_l_c_v</file-name-pattern>-->
 
<!--Example pattern using LCID (locale ID)-->
 
<!-- If your resource files are under a folder named 'resources' with an LCID suffix separated by an-->
 
<!-- underscore, then the pattern would be:-->
 
<!-- <file-location-pattern>resources_LCID</file-location-pattern>-->
 
 
<resource-extension>
 
<resource-extension>
  +
'''&lt;!-- parser-type not needed since .rc is a standard LRM extension that maps to the rc parser type --&gt;'''
<extension>rc</extension>
 
  +
'''<extension>rc</extension>'''
<file-name-pattern/>
 
<!--If the base resource files use the file-name-pattern in their name -->
+
'''<file-name-pattern/>'''
<!--then set use-pattern-on-dflt-locale to 1, if not then set to 0-->
+
'''<use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>'''
<use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>
+
'''<file-location-pattern>*_LCID</file-location-pattern>'''
<file-location-pattern>*_LCID</file-location-pattern>
+
'''<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>'''
  +
'''<base-file-encoding>UTF-16LE</base-file-encoding>'''
<!--If the base resource files use the file-location-pattern in their name -->
 
  +
'''<localized-file-encoding>UTF-16LE</localized-file-encoding>'''
<!--then set use-location-pattern-on-dflt-locale to 1, if not then set to 0-->
 
<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>
+
'''<parameter-regex-pattern><![CDATA[%\d+]]></parameter-regex-pattern>'''
  +
</resource-extension>
<base-file-encoding>UTF-16LE</base-file-encoding>
 
  +
<resource-extension>
<localized-file-encoding>UTF-16LE</localized-file-encoding>
 
  +
'''&lt;!-- parser-type is required because .myext is not a standard LRM extension --&gt;'''
<!--Default pattern for rc is '![CDATA[%\d+]]'-->
 
  +
'''<extension>''myext''</extension>'''
<parameter-regex-pattern><![CDATA[%\d+]]></parameter-regex-pattern>
 
  +
'''''<parser-type>rc</parser-type>'''''
</resource-extension>
 
  +
'''<file-name-pattern/>'''
  +
'''<use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>'''
  +
'''<file-location-pattern>*_LCID</file-location-pattern>'''
  +
'''<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>'''
  +
'''<base-file-encoding>UTF-16LE</base-file-encoding>'''
  +
'''<localized-file-encoding>UTF-16LE</localized-file-encoding>'''
  +
'''<parameter-regex-pattern><![CDATA[%\d+]]></parameter-regex-pattern>'''
  +
</resource-extension>
 
</resources-extensions>
 
</resources-extensions>
<dirset>
 
<!--Define the search patterns to include and/or exclude. (Uses Apache Ant pattern search).-->
 
<!--Examples: -->
 
<!-- A. '**/*.properties' matches all .properties files/dirs in a directory tree.-->
 
<!-- B. 'test/a??.resx' matches all files/dirs which start with an 'a', -->
 
<!-- then two more characters and then '.resx', in a directory called test.-->
 
<!-- C. '**' matches everything in a directory tree. -->
 
<!-- '**/source/**/XYZ*' matches all files/dirs which start with 'XYZ'-->
 
<!-- and where there is a parent directory called source (e.g. 'abc/source/def/ghi/XYZ123'). -->
 
<includes>
 
<!--Directories to include in the search for base resource files -->
 
<!--Examples: -->
 
<!-- <include-dir>**/source/**</include-dir>-->
 
</includes>
 
<excludes>
 
<!--Directories or files to exclude in the search -->
 
<!--Examples: -->
 
<!-- <exclude-dir-file>**/source/bin/**</exclude-dir-file> -->
 
<!-- <exclude-dir-file>**/fileToIgnore.*</exclude-dir-file> -->
 
</excludes>
 
</dirset>
 
</lrmconf>
 

Latest revision as of 16:33, 30 January 2018

Example .rc file or a file extension that uses the rc parser type

// Microsoft Visual C++ generated resource script.
//
#include "Smoke.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#pragma code_page(1252)

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

/////////////////////////////////////////////////////////////////////////////
// Default Locale Resources



// SHARED_ENTRIES
STRINGTABLE
BEGIN
    FILT_TRUE_5    "true"
END
// END_SHARED_ENTRIES

// SOURCE_FILE C:/Path/to/my/source/file/FilterPatternOrderTests.js
STRINGTABLE
BEGIN
    FILT_TRUE_4    "true"
    FILT_DDMMYYY_6    "dd/MM/yyyy"
END

// SOURCE_FILE C:/Path/to/my/source/file/example-source-javascript/strings.js
STRINGTABLE
BEGIN
    STRI_ANDTHIS_1    "&and this "
    STRI_ISHOULD_2    "I should be detected because not in ignore next line comment"
    STRI_ISHOULD_3    "I should be detected because outside ignore start/end block"
END

rc parser type

valid rc syntax

Files that use the rc parser are expected to have valid rc syntax. Key and corresponding value must be on the same line.

.rc uses the rc parser type

When defining a project containing LRM Standard .rc extension resource files, there is no need to define a <parser-type> as the rc parser will always be used.

unique file extension needs to define rc parser type

If a unique file extension is a valid .rc file, then the <parser-type> should be rc in the project definition file.

Example of Project Definition for Resources

The following is an example of rc resource file definitions. See resource extensions for more information.

  <resources-extensions>
    <resource-extension>
     <!-- parser-type not needed since .rc is a standard LRM extension that maps to the rc parser type -->    
     <extension>rc</extension>
     <file-name-pattern/>
     <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>
     <file-location-pattern>*_LCID</file-location-pattern>
     <use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>
     <base-file-encoding>UTF-16LE</base-file-encoding>
     <localized-file-encoding>UTF-16LE</localized-file-encoding>
     <parameter-regex-pattern><![CDATA[%\d+]]></parameter-regex-pattern>
    </resource-extension>
    <resource-extension>
     <!-- parser-type is required because .myext is not a standard LRM extension -->    
     <extension>myext</extension>
     <parser-type>rc</parser-type>
     <file-name-pattern/>
     <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>
     <file-location-pattern>*_LCID</file-location-pattern>
     <use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>
     <base-file-encoding>UTF-16LE</base-file-encoding>
     <localized-file-encoding>UTF-16LE</localized-file-encoding>
     <parameter-regex-pattern><![CDATA[%\d+]]></parameter-regex-pattern>
    </resource-extension>
  </resources-extensions>