2011-08-11 16:39:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-08-16 13:48:51 +00:00
|
|
|
usage() {
|
2011-08-11 16:39:33 +00:00
|
|
|
cat << EOF
|
[IMP] refactored translation system to merge web translations with addons translations
- Moved the web *.po files to /i18n to be consistent
with the addons convention. Using /po was considered
for a while because it played better with LP's auto-
detection of PO Templates, but that is not necessary
anymore, we now have full control on LP templates.
- In order to support addons that contain translations
for both the web addon and the regular addon part,
both kinds of translations are now merged in a single
addon/i18n/addon.pot file. Terms that are used by
the web part are now marked with a PO annotation:
#. openerp-web
so the web client can recognize them and only load
the relevant translations in the browser memory.
This is important because a complete PO file can
be rather large, e.g. account/i18n/de.po = 400KB.
- The web translation export scripts were updated to
behave properly for addons that have a non-web
part, and will merge the web translation in the
original POT file, annotating the web translations
as needed. These scripts are Unix-only and meant
to be used by OpenERP packagers when needed.
- The GetText spec says that PO auto-comments indicating
the source location have this form:
#: /path/to/file:lineno
However OpenERP's POT export system defaults to a modified
version of this format with an extra 'type' field:
#: type:/path/to/file:lineno
The babel extractors we use have the GetText format
hardcoded so a small patch is needed on the server
to make it more lenient and accept the standard
source annotation, defaulting to 'code' type.
This does not matter for openerp-web, but makes sure
the server will not fail to load the new PO files
that contain openerp-web translations with standard
annotations.
The patch for making the server more lenient was
checked in trunk at revision 4002
rev-id odo@openerp.com-20120202143210-05p1w24t6u77cyv8
- The existing translation sync and export wizards for
regular addons have not been updated to consider
web addons, so for the time being we will have
to export regular addons terms first, and run the
web export script (gen_translations.sh) on the
addons directory afterwards. This could be improved
later.
As soon as this change is merged we will have to
perform a full update of addons translation
templates in order to include the web terms as well.
bzr revid: odo@openerp.com-20120202145603-ffo0il0qnfp3r6gt
2012-02-02 14:56:03 +00:00
|
|
|
usage: $0 -a [DIR]
|
|
|
|
usage: $0 <ADDON_DIR> <OUTPUT_FILE>
|
2011-08-11 16:39:33 +00:00
|
|
|
|
|
|
|
OPTIONS:
|
[IMP] refactored translation system to merge web translations with addons translations
- Moved the web *.po files to /i18n to be consistent
with the addons convention. Using /po was considered
for a while because it played better with LP's auto-
detection of PO Templates, but that is not necessary
anymore, we now have full control on LP templates.
- In order to support addons that contain translations
for both the web addon and the regular addon part,
both kinds of translations are now merged in a single
addon/i18n/addon.pot file. Terms that are used by
the web part are now marked with a PO annotation:
#. openerp-web
so the web client can recognize them and only load
the relevant translations in the browser memory.
This is important because a complete PO file can
be rather large, e.g. account/i18n/de.po = 400KB.
- The web translation export scripts were updated to
behave properly for addons that have a non-web
part, and will merge the web translation in the
original POT file, annotating the web translations
as needed. These scripts are Unix-only and meant
to be used by OpenERP packagers when needed.
- The GetText spec says that PO auto-comments indicating
the source location have this form:
#: /path/to/file:lineno
However OpenERP's POT export system defaults to a modified
version of this format with an extra 'type' field:
#: type:/path/to/file:lineno
The babel extractors we use have the GetText format
hardcoded so a small patch is needed on the server
to make it more lenient and accept the standard
source annotation, defaulting to 'code' type.
This does not matter for openerp-web, but makes sure
the server will not fail to load the new PO files
that contain openerp-web translations with standard
annotations.
The patch for making the server more lenient was
checked in trunk at revision 4002
rev-id odo@openerp.com-20120202143210-05p1w24t6u77cyv8
- The existing translation sync and export wizards for
regular addons have not been updated to consider
web addons, so for the time being we will have
to export regular addons terms first, and run the
web export script (gen_translations.sh) on the
addons directory afterwards. This could be improved
later.
As soon as this change is merged we will have to
perform a full update of addons translation
templates in order to include the web terms as well.
bzr revid: odo@openerp.com-20120202145603-ffo0il0qnfp3r6gt
2012-02-02 14:56:03 +00:00
|
|
|
-a [DIR] export the .pot files for all web addons found
|
|
|
|
at target path (default: ./addons)
|
|
|
|
-h print this message
|
2011-08-11 16:39:33 +00:00
|
|
|
EOF
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
do_all=
|
|
|
|
|
|
|
|
while getopts "a" opt
|
|
|
|
do
|
|
|
|
case "$opt" in
|
|
|
|
a)
|
|
|
|
do_all=true;;
|
|
|
|
h)
|
|
|
|
usage;;
|
|
|
|
\?)
|
|
|
|
usage;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
|
|
|
if [ -n "$do_all" ]
|
|
|
|
then
|
2012-02-06 15:04:28 +00:00
|
|
|
if [ "x$(which msgcat)" = "x" ]
|
|
|
|
then
|
2012-02-06 15:43:45 +00:00
|
|
|
echo "The msgcat command from the gettext tools is required in the PATH."
|
2012-02-06 15:04:28 +00:00
|
|
|
echo "On a Debian/Ubuntu system you may install gettext via 'sudo apt-get install gettext'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
[IMP] refactored translation system to merge web translations with addons translations
- Moved the web *.po files to /i18n to be consistent
with the addons convention. Using /po was considered
for a while because it played better with LP's auto-
detection of PO Templates, but that is not necessary
anymore, we now have full control on LP templates.
- In order to support addons that contain translations
for both the web addon and the regular addon part,
both kinds of translations are now merged in a single
addon/i18n/addon.pot file. Terms that are used by
the web part are now marked with a PO annotation:
#. openerp-web
so the web client can recognize them and only load
the relevant translations in the browser memory.
This is important because a complete PO file can
be rather large, e.g. account/i18n/de.po = 400KB.
- The web translation export scripts were updated to
behave properly for addons that have a non-web
part, and will merge the web translation in the
original POT file, annotating the web translations
as needed. These scripts are Unix-only and meant
to be used by OpenERP packagers when needed.
- The GetText spec says that PO auto-comments indicating
the source location have this form:
#: /path/to/file:lineno
However OpenERP's POT export system defaults to a modified
version of this format with an extra 'type' field:
#: type:/path/to/file:lineno
The babel extractors we use have the GetText format
hardcoded so a small patch is needed on the server
to make it more lenient and accept the standard
source annotation, defaulting to 'code' type.
This does not matter for openerp-web, but makes sure
the server will not fail to load the new PO files
that contain openerp-web translations with standard
annotations.
The patch for making the server more lenient was
checked in trunk at revision 4002
rev-id odo@openerp.com-20120202143210-05p1w24t6u77cyv8
- The existing translation sync and export wizards for
regular addons have not been updated to consider
web addons, so for the time being we will have
to export regular addons terms first, and run the
web export script (gen_translations.sh) on the
addons directory afterwards. This could be improved
later.
As soon as this change is merged we will have to
perform a full update of addons translation
templates in order to include the web terms as well.
bzr revid: odo@openerp.com-20120202145603-ffo0il0qnfp3r6gt
2012-02-02 14:56:03 +00:00
|
|
|
echo "Extracting all web addons translations"
|
2011-08-16 13:48:51 +00:00
|
|
|
executable=$0
|
[IMP] refactored translation system to merge web translations with addons translations
- Moved the web *.po files to /i18n to be consistent
with the addons convention. Using /po was considered
for a while because it played better with LP's auto-
detection of PO Templates, but that is not necessary
anymore, we now have full control on LP templates.
- In order to support addons that contain translations
for both the web addon and the regular addon part,
both kinds of translations are now merged in a single
addon/i18n/addon.pot file. Terms that are used by
the web part are now marked with a PO annotation:
#. openerp-web
so the web client can recognize them and only load
the relevant translations in the browser memory.
This is important because a complete PO file can
be rather large, e.g. account/i18n/de.po = 400KB.
- The web translation export scripts were updated to
behave properly for addons that have a non-web
part, and will merge the web translation in the
original POT file, annotating the web translations
as needed. These scripts are Unix-only and meant
to be used by OpenERP packagers when needed.
- The GetText spec says that PO auto-comments indicating
the source location have this form:
#: /path/to/file:lineno
However OpenERP's POT export system defaults to a modified
version of this format with an extra 'type' field:
#: type:/path/to/file:lineno
The babel extractors we use have the GetText format
hardcoded so a small patch is needed on the server
to make it more lenient and accept the standard
source annotation, defaulting to 'code' type.
This does not matter for openerp-web, but makes sure
the server will not fail to load the new PO files
that contain openerp-web translations with standard
annotations.
The patch for making the server more lenient was
checked in trunk at revision 4002
rev-id odo@openerp.com-20120202143210-05p1w24t6u77cyv8
- The existing translation sync and export wizards for
regular addons have not been updated to consider
web addons, so for the time being we will have
to export regular addons terms first, and run the
web export script (gen_translations.sh) on the
addons directory afterwards. This could be improved
later.
As soon as this change is merged we will have to
perform a full update of addons translation
templates in order to include the web terms as well.
bzr revid: odo@openerp.com-20120202145603-ffo0il0qnfp3r6gt
2012-02-02 14:56:03 +00:00
|
|
|
target_dir=${1:-./addons}
|
|
|
|
echo "Using target dir: ${target_dir}"
|
2012-02-06 15:04:28 +00:00
|
|
|
for mod in $(find ${target_dir} -type d -name 'static' -exec sh -c 'basename $(dirname {})' \;); do
|
[IMP] refactored translation system to merge web translations with addons translations
- Moved the web *.po files to /i18n to be consistent
with the addons convention. Using /po was considered
for a while because it played better with LP's auto-
detection of PO Templates, but that is not necessary
anymore, we now have full control on LP templates.
- In order to support addons that contain translations
for both the web addon and the regular addon part,
both kinds of translations are now merged in a single
addon/i18n/addon.pot file. Terms that are used by
the web part are now marked with a PO annotation:
#. openerp-web
so the web client can recognize them and only load
the relevant translations in the browser memory.
This is important because a complete PO file can
be rather large, e.g. account/i18n/de.po = 400KB.
- The web translation export scripts were updated to
behave properly for addons that have a non-web
part, and will merge the web translation in the
original POT file, annotating the web translations
as needed. These scripts are Unix-only and meant
to be used by OpenERP packagers when needed.
- The GetText spec says that PO auto-comments indicating
the source location have this form:
#: /path/to/file:lineno
However OpenERP's POT export system defaults to a modified
version of this format with an extra 'type' field:
#: type:/path/to/file:lineno
The babel extractors we use have the GetText format
hardcoded so a small patch is needed on the server
to make it more lenient and accept the standard
source annotation, defaulting to 'code' type.
This does not matter for openerp-web, but makes sure
the server will not fail to load the new PO files
that contain openerp-web translations with standard
annotations.
The patch for making the server more lenient was
checked in trunk at revision 4002
rev-id odo@openerp.com-20120202143210-05p1w24t6u77cyv8
- The existing translation sync and export wizards for
regular addons have not been updated to consider
web addons, so for the time being we will have
to export regular addons terms first, and run the
web export script (gen_translations.sh) on the
addons directory afterwards. This could be improved
later.
As soon as this change is merged we will have to
perform a full update of addons translation
templates in order to include the web terms as well.
bzr revid: odo@openerp.com-20120202145603-ffo0il0qnfp3r6gt
2012-02-02 14:56:03 +00:00
|
|
|
echo ${mod}
|
|
|
|
mod_pot=${target_dir}/${mod}/i18n/${mod}.pot
|
|
|
|
web_pot=${mod_pot}.web
|
2012-02-06 15:04:28 +00:00
|
|
|
mkdir -p $(dirname ${web_pot})
|
[IMP] refactored translation system to merge web translations with addons translations
- Moved the web *.po files to /i18n to be consistent
with the addons convention. Using /po was considered
for a while because it played better with LP's auto-
detection of PO Templates, but that is not necessary
anymore, we now have full control on LP templates.
- In order to support addons that contain translations
for both the web addon and the regular addon part,
both kinds of translations are now merged in a single
addon/i18n/addon.pot file. Terms that are used by
the web part are now marked with a PO annotation:
#. openerp-web
so the web client can recognize them and only load
the relevant translations in the browser memory.
This is important because a complete PO file can
be rather large, e.g. account/i18n/de.po = 400KB.
- The web translation export scripts were updated to
behave properly for addons that have a non-web
part, and will merge the web translation in the
original POT file, annotating the web translations
as needed. These scripts are Unix-only and meant
to be used by OpenERP packagers when needed.
- The GetText spec says that PO auto-comments indicating
the source location have this form:
#: /path/to/file:lineno
However OpenERP's POT export system defaults to a modified
version of this format with an extra 'type' field:
#: type:/path/to/file:lineno
The babel extractors we use have the GetText format
hardcoded so a small patch is needed on the server
to make it more lenient and accept the standard
source annotation, defaulting to 'code' type.
This does not matter for openerp-web, but makes sure
the server will not fail to load the new PO files
that contain openerp-web translations with standard
annotations.
The patch for making the server more lenient was
checked in trunk at revision 4002
rev-id odo@openerp.com-20120202143210-05p1w24t6u77cyv8
- The existing translation sync and export wizards for
regular addons have not been updated to consider
web addons, so for the time being we will have
to export regular addons terms first, and run the
web export script (gen_translations.sh) on the
addons directory afterwards. This could be improved
later.
As soon as this change is merged we will have to
perform a full update of addons translation
templates in order to include the web terms as well.
bzr revid: odo@openerp.com-20120202145603-ffo0il0qnfp3r6gt
2012-02-02 14:56:03 +00:00
|
|
|
$executable ${target_dir}/${mod} ${web_pot}
|
|
|
|
if [ -f "${mod_pot}" ]; then
|
|
|
|
echo "Merging with existing PO file: ${mod_pot}"
|
2012-02-06 15:04:28 +00:00
|
|
|
msgcat --force-po -o "${mod_pot}.tmp" ${mod_pot} ${web_pot}
|
[IMP] refactored translation system to merge web translations with addons translations
- Moved the web *.po files to /i18n to be consistent
with the addons convention. Using /po was considered
for a while because it played better with LP's auto-
detection of PO Templates, but that is not necessary
anymore, we now have full control on LP templates.
- In order to support addons that contain translations
for both the web addon and the regular addon part,
both kinds of translations are now merged in a single
addon/i18n/addon.pot file. Terms that are used by
the web part are now marked with a PO annotation:
#. openerp-web
so the web client can recognize them and only load
the relevant translations in the browser memory.
This is important because a complete PO file can
be rather large, e.g. account/i18n/de.po = 400KB.
- The web translation export scripts were updated to
behave properly for addons that have a non-web
part, and will merge the web translation in the
original POT file, annotating the web translations
as needed. These scripts are Unix-only and meant
to be used by OpenERP packagers when needed.
- The GetText spec says that PO auto-comments indicating
the source location have this form:
#: /path/to/file:lineno
However OpenERP's POT export system defaults to a modified
version of this format with an extra 'type' field:
#: type:/path/to/file:lineno
The babel extractors we use have the GetText format
hardcoded so a small patch is needed on the server
to make it more lenient and accept the standard
source annotation, defaulting to 'code' type.
This does not matter for openerp-web, but makes sure
the server will not fail to load the new PO files
that contain openerp-web translations with standard
annotations.
The patch for making the server more lenient was
checked in trunk at revision 4002
rev-id odo@openerp.com-20120202143210-05p1w24t6u77cyv8
- The existing translation sync and export wizards for
regular addons have not been updated to consider
web addons, so for the time being we will have
to export regular addons terms first, and run the
web export script (gen_translations.sh) on the
addons directory afterwards. This could be improved
later.
As soon as this change is merged we will have to
perform a full update of addons translation
templates in order to include the web terms as well.
bzr revid: odo@openerp.com-20120202145603-ffo0il0qnfp3r6gt
2012-02-02 14:56:03 +00:00
|
|
|
mv ${mod_pot}.tmp ${mod_pot}
|
|
|
|
rm ${web_pot}
|
|
|
|
else
|
|
|
|
echo "Renaming to final PO file: ${mod_pot}"
|
|
|
|
mv ${web_pot} ${mod_pot}
|
|
|
|
fi
|
|
|
|
done
|
2011-08-11 16:39:33 +00:00
|
|
|
elif [ -n "$2" ]
|
|
|
|
then
|
2011-12-16 13:00:00 +00:00
|
|
|
./npybabel.py extract -F babel.cfg -o $2 -k _t -k _lt --no-default-keywords $1
|
2011-08-11 16:39:33 +00:00
|
|
|
else
|
|
|
|
usage
|
|
|
|
fi
|