Difference between revisions of "LRM po Support"

From Lingoport Wiki
Jump to: navigation, search
(Example .po files)
(Example Project Definition File)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Example .po files ==
+
== Example of .po files as well as file extensions using the ''po'' parser type ==
 
<pre>
 
<pre>
 
# SOME DESCRIPTIVE TITLE.
 
# SOME DESCRIPTIVE TITLE.
Line 17: Line 17:
 
"Content-Type: text/plain; charset=UTF-8\n"
 
"Content-Type: text/plain; charset=UTF-8\n"
 
"Content-Transfer-Encoding: 8bit\n"
 
"Content-Transfer-Encoding: 8bit\n"
 
   
 
# SOURCE_FILE C:/Path/to/my/source/files/Matrix.js
 
# SOURCE_FILE C:/Path/to/my/source/files/Matrix.js
Line 28: Line 27:
 
msgid "Viewing rows {0} to {1} of {2}"
 
msgid "Viewing rows {0} to {1} of {2}"
 
msgstr "Viewing rows {0} to {1} of {2}"
 
msgstr "Viewing rows {0} to {1} of {2}"
 
   
 
# SOURCE_FILE C:/Path/to/my/source/files/cache.js
 
# SOURCE_FILE C:/Path/to/my/source/files/cache.js
Line 41: Line 39:
 
msgstr "//record[record]"
 
msgstr "//record[record]"
 
</pre>
 
</pre>
  +
  +
== ''po'' parser type ==
  +
=== valid po syntax ===
  +
Files that use the ''po'' parser are expected to have valid po syntax
  +
=== .po uses the ''po'' parser type===
  +
When defining a project containing LRM Standard .po resource files, there is no need to define a ''&lt;parser-type&gt;'' as the ''po'' parser will always be used.
  +
  +
=== unique file extension needs to define ''json'' parser type ===
  +
If a unique file extension is a valid po file, then the ''&lt;parser-type&gt;'' should be ''po'' in the project definition file.
  +
  +
== Example of Project Definition for Resources ==
  +
The following is an example of po resource file definitions. See [[Supported_Resource_Bundles#Resource_Extensions| resource extensions]] for more information.
  +
  +
<resource-extensions>
  +
<resource-extension>
  +
'''&lt;!-- parser-type not needed since .po is a standard LRM extension that maps to the po parser type --&gt;'''
  +
'''<extension>po</extension>'''
  +
'''<file-name-pattern>*-l_c_v</file-name-pattern>'''
  +
'''<use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>'''
  +
'''<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]|%\d+]]></parameter-regex-pattern>'''
  +
</resource-extension>
  +
<resource-extension>
  +
'''&lt;!-- parser-type is required because .myext is not a standard LRM extension --&gt;'''
  +
'''<extension>''myext''</extension>'''
  +
'''''<parser-type>po</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/>'''
  +
'''<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]|%\d+]]></parameter-regex-pattern>'''
  +
</resource-extension>
  +
</resource-extensions>

Latest revision as of 20:25, 18 September 2017

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

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-01 16:55-0700\n"
"PO-Revision-Date: 2017-02-01 16:55-0700\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

# SOURCE_FILE C:/Path/to/my/source/files/Matrix.js
msgid "ascending"
msgstr "ascending"

msgid "descending"
msgstr "descending"

msgid "Viewing rows {0} to {1} of {2}"
msgstr "Viewing rows {0} to {1} of {2}"

# SOURCE_FILE C:/Path/to/my/source/files/cache.js

msgid "You have made unsaved changes to the following cache document(s): <b>"
msgstr "You have made unsaved changes to the following cache document(s): <b>"

msgid "</b>. Procede with delete?"
msgstr "</b>. Procede with delete?"

msgid "//record[record]"
msgstr "//record[record]"

po parser type

valid po syntax

Files that use the po parser are expected to have valid po syntax

.po uses the po parser type

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

unique file extension needs to define json parser type

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

Example of Project Definition for Resources

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

 <resource-extensions>
   <resource-extension>
     <!-- parser-type not needed since .po is a standard LRM extension that maps to the po parser type -->
     <extension>po</extension>
     <file-name-pattern>*-l_c_v</file-name-pattern>
     <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>
     <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]|%\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>po</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/>
     <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]|%\d+]]></parameter-regex-pattern>
   </resource-extension>
 </resource-extensions>