Add localization infrastructure
review13031002 issue4602
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Add localization infrastructure
|
||||
* Add support for PyPy
|
||||
* Synchronize chart of account with the official source
|
||||
|
||||
|
||||
@@ -3,6 +3,16 @@ trytond_account_be
|
||||
|
||||
The account_be module of the Tryton application platform.
|
||||
|
||||
The module generates french and dutch chart of accounts / chart of taxes. The
|
||||
french / dutch XML files are generated from the same original XML file thanks
|
||||
to the localize.xsl XSLT script. The script will produce on the standard output
|
||||
the desired XML file. The XSLT script can be launched with the following
|
||||
command::
|
||||
|
||||
xsltproc --stringparam lang <lang> localize.xsl <xml file>
|
||||
|
||||
where ``lang`` is either ``fr`` or ``nl``.
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
from .account import *
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
AccountTemplate,
|
||||
module='account_be', type_='model')
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from sql.operators import Concat
|
||||
from sql.functions import Position
|
||||
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['AccountTemplate']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
class AccountTemplate:
|
||||
__name__ = 'account.account.template'
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
pool = Pool()
|
||||
ModelData = pool.get('ir.model.data')
|
||||
cursor = Transaction().cursor
|
||||
model_data = ModelData.__table__()
|
||||
|
||||
# Migration from 3.4: translation of the account chart
|
||||
cursor.execute(*model_data.update(
|
||||
columns=[model_data.fs_id],
|
||||
values=[Concat(model_data.fs_id, '_fr')],
|
||||
where=((Position('_fr', model_data.fs_id) == 0)
|
||||
& (model_data.module == 'account_be'))))
|
||||
|
||||
super(AccountTemplate, cls).__register__(module_name)
|
||||
+1610
-1045
File diff suppressed because it is too large
Load Diff
+6643
File diff suppressed because it is too large
Load Diff
+6643
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:param name="lang"/>
|
||||
<xsl:template match="record[@id]">
|
||||
<xsl:copy>
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="attribute::id"/>_<xsl:value-of select="$lang"/>
|
||||
</xsl:attribute>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<xsl:template match="@*">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id' or name()='lang'"></xsl:when>
|
||||
<xsl:when test="name()='ref'">
|
||||
<xsl:attribute name="ref">
|
||||
<xsl:value-of select="."/>_<xsl:value-of select="$lang"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="node()">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@lang=$lang or not(@lang)">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:transform>
|
||||
+459
-462
File diff suppressed because it is too large
Load Diff
+1796
File diff suppressed because it is too large
Load Diff
+1796
File diff suppressed because it is too large
Load Diff
+4
-2
@@ -3,5 +3,7 @@ version=3.5.0
|
||||
depends:
|
||||
account
|
||||
xml:
|
||||
account_be.xml
|
||||
tax_be.xml
|
||||
account_be_fr.xml
|
||||
tax_be_fr.xml
|
||||
account_be_nl.xml
|
||||
tax_be_nl.xml
|
||||
|
||||
Reference in New Issue
Block a user