LRM msg Support: Difference between revisions

From Lingoport Wiki
Jump to navigation Jump to search
Line 31: Line 31:
   <project-name>DemoMsg</project-name>
   <project-name>DemoMsg</project-name>
   <project-desc>This is a sample LRM Project definition file, configured for Msg resource files</project-desc>
   <project-desc>This is a sample LRM Project definition file, configured for Msg resource files</project-desc>
  <!--group-name contains either the company name or the group name. -->
   <group-name>acme</group-name>
   <group-name>acme</group-name>
  <!-- Example, linux -->
  <!--<top-level-dir>/var/lib/job/workspace/acme/source</top-level-dir>-->
   <top-level-dir>C:\acme\source</top-level-dir>
   <top-level-dir>C:\acme\source</top-level-dir>
   <detect-errors>
   <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>1</missed-trans-error>
     <missed-trans-error>1</missed-trans-error>
     <parameter-mismatch-error>1</parameter-mismatch-error>
     <parameter-mismatch-error>1</parameter-mismatch-error>
   </detect-errors>
   </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>
   <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>
   <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 base (default) locale-->
   <target-locales>
   <target-locales>
     <locale>es_MX</locale>
     <locale>es_MX</locale>
Line 57: Line 44:
     <locale>fr_FR</locale>
     <locale>fr_FR</locale>
   </target-locales>
   </target-locales>
  <!--Default locale is the base locale. This is the locale where corresponding resource files will not be translated.-->
  <!--The base (default) locale is mutually exclusive of the target locales-->
   <default-locale>en_US</default-locale>
   <default-locale>en_US</default-locale>
   <resource-extensions>
   <resource-extensions>
    <!--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>
       '''<extension>msg</extension>'''
       '''<extension>msg</extension>'''
       '''<file-name-pattern>*_l_c_v</file-name-pattern>'''
       '''<file-name-pattern>*_l_c_v</file-name-pattern>'''
      <!--If the base resource files use the file-name-pattern in their name -->
      <!--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></file-location-pattern>'''
       '''<file-location-pattern></file-location-pattern>'''
      <!--If the base resource files use the file-location-pattern in their name -->
      <!--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>'''
       '''<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>'''
       '''<base-file-encoding>UTF-8</base-file-encoding>'''
       '''<base-file-encoding>UTF-8</base-file-encoding>'''
       '''<localized-file-encoding>UTF-8</localized-file-encoding>'''
       '''<localized-file-encoding>UTF-8</localized-file-encoding>'''
      <!--Default pattern for xml is '![CDATA[%\\d+%|%[ds]]]'-->
       '''<parameter-regex-pattern><![CDATA[%\\d+%|%[ds]]]></parameter-regex-pattern>'''
       '''<parameter-regex-pattern><![CDATA[%\\d+%|%[ds]]]></parameter-regex-pattern>'''
     </resource-extension>
     </resource-extension>
Line 93: Line 60:
       '''''<parser-type>msg</parser-type>'''''
       '''''<parser-type>msg</parser-type>'''''
       '''<file-name-pattern>*_l_c_v</file-name-pattern>'''
       '''<file-name-pattern>*_l_c_v</file-name-pattern>'''
      <!--If the base resource files use the file-name-pattern in their name -->
      <!--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></file-location-pattern>'''
       '''<file-location-pattern></file-location-pattern>'''
      <!--If the base resource files use the file-location-pattern in their name -->
      <!--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>'''
       '''<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>'''
       '''<base-file-encoding>UTF-8</base-file-encoding>'''
       '''<base-file-encoding>UTF-8</base-file-encoding>'''
       '''<localized-file-encoding>UTF-8</localized-file-encoding>'''
       '''<localized-file-encoding>UTF-8</localized-file-encoding>'''
      <!--Default pattern for xml is '![CDATA[%\\d+%|%[ds]]]'-->
       '''<parameter-regex-pattern><![CDATA[%\\d+%|%[ds]]]></parameter-regex-pattern>'''
       '''<parameter-regex-pattern><![CDATA[%\\d+%|%[ds]]]></parameter-regex-pattern>'''
     </resource-extension>
     </resource-extension>
   </resource-extensions>
   </resource-extensions>
   <dirset>
   <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. -->
    <!--  D.  '**/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>
     <includes>
       <!--Directories to include in the search for base resource files -->
       <include-dir-file>**/src/**</include-dir-file>
      <!--Examples: -->
      <!--  <include-dir>**/source/**</include-dir>-->
      <include-dir>**/**</include-dir>
     </includes>
     </includes>
     <excludes>
     <excludes>
       <!--Directories or files to exclude in the search -->
       <exclude-dir-file>**/src/bin/**</exclude-dir-file>
      <!--Examples: -->
      <!--  <exclude-dir-file>**/source/bin/**</exclude-dir-file> -->
      <!--  <exclude-dir-file>**/fileToIgnore.*</exclude-dir-file> -->
     </excludes>
     </excludes>
   </dirset>
   </dirset>
  </lrmconf>
  </lrmconf>

Revision as of 20:45, 31 August 2017

Example of .msg files as well as file extensions using the msg parser type

$ A Globalyzer generated message file

$set MainSet

$  SOURCE_FILE C:/Path/to/my/source/StringBug.hpp
STRI_BADLINE_6 "Bad line"
STRI_INVALID_7 "Invalid Rectangle"
STRI_INVALID_8 "Invalid Color"
STRI_INVALID_9 "Invalid Point"
STRI_INVALID_10 "Invalid DWORD"
STRI_UNRECOG_11 "Unrecognized type"
STRI_SLINEDS_12 "%s (line #%d) : %s"
STRI_RUNTIME_13 "Runtime Variable Error"
STRI_KEYNOTF_14 "Key not found"

$  SOURCE_FILE C:/Path/to/my/source/keypressEvents.cxx
KEYP_PRESSED_1 "Pressed "
KEYP_UP_2 "Up"
KEYP_THEUPAR_3 "The up arrow was pressed."
KEYP_SHOULDD_4 "Should detect because ignore second issue"
KEYP_THEAKEY_5 "The a key was pressed."

Example Project Definition File

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<lrmconf>
 <model-version>2.0.11</model-version>
 <project-name>DemoMsg</project-name>
 <project-desc>This is a sample LRM Project definition file, configured for Msg resource files</project-desc>
 <group-name>acme</group-name>
 <top-level-dir>C:\acme\source</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>es_MX</locale>
   <locale>fr_CA</locale>
   <locale>fr_FR</locale>
 </target-locales>
 <default-locale>en_US</default-locale>
 <resource-extensions>
   <resource-extension>
     <extension>msg</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[%\\d+%|%[ds]]]></parameter-regex-pattern>
   </resource-extension>
   <resource-extension>
     <extension>myext</extension>
     <parser-type>msg</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[%\\d+%|%[ds]]]></parameter-regex-pattern>
   </resource-extension>
 </resource-extensions>
 <dirset>
   <includes>
     <include-dir-file>**/src/**</include-dir-file>
   </includes>
   <excludes>
     <exclude-dir-file>**/src/bin/**</exclude-dir-file>
   </excludes>
 </dirset>
</lrmconf>