Skip to content

Commit

Permalink
Implement Internationalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
MasaGon committed Mar 5, 2013
1 parent e82d8cb commit 31f8685
Show file tree
Hide file tree
Showing 4 changed files with 398 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CsvImportPlugin.php
Expand Up @@ -71,6 +71,7 @@ class CsvImportPlugin extends Omeka_Plugin_AbstractPlugin
protected $_hooks = array('install',
'uninstall',
'upgrade',
'initialize',
'admin_head',
'define_acl');

Expand Down Expand Up @@ -157,6 +158,14 @@ public function hookUpgrade($args)
}
}

/**
* Add the translations.
*/
public function hookInitialize()
{
add_translation_source(dirname(__FILE__) . '/languages');
}

/**
* Define the ACL.
*
Expand Down
51 changes: 51 additions & 0 deletions build.xml
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="CsvImport" basedir=".">
<property name="lang.dir" location="languages" />
<property name="core.pot" location="../../application/languages/Omeka.pot" />
<target name="update-pot" description="Update the translation template.">
<property name="pot.file" location="${lang.dir}/template.pot"/>
<property name="pot.base" location="${lang.dir}/template.base.pot"/>
<tempfile property="pot.temp" suffix=".pot"/>
<tempfile property="pot.duplicates" suffix="-duplicates.pot" />
<copy file="${pot.base}" tofile="${pot.temp}"/>
<apply executable="xgettext" relative="true" parallel="true" verbose="true">
<arg value="--language=php"/>
<arg value="--from-code=utf-8"/>
<arg value="--keyword=__"/>
<arg value="--flag=__:1:pass-php-format"/>
<arg value="--add-comments=/"/>
<arg value="--omit-header"/>
<arg value="--join-existing"/>
<arg value="-o"/>
<arg file="${pot.temp}"/>
<fileset dir="." includes="**/*.php **/*.phtml"
excludes="tests/"/>
</apply>
<exec executable="msgcomm">
<arg value="--omit-header" />
<arg value="-o" />
<arg file="${pot.duplicates}" />
<arg file="${pot.temp}" />
<arg file="${core.pot}" />
</exec>
<exec executable="msgcomm">
<arg value="--unique" />
<arg value="-o" />
<arg file="${pot.temp}" />
<arg file="${pot.temp}" />
<arg file="${pot.duplicates}" />
</exec>
<move file="${pot.temp}" tofile="${pot.file}"/>
<delete file="${pot.duplicates}" quiet="true" />
</target>

<target name="build-mo" description="Build the MO translation files.">
<apply executable="msgfmt" dest="${lang.dir}" verbose="true">
<arg value="-o"/>
<targetfile />
<srcfile />
<fileset dir="${lang.dir}" includes="*.po"/>
<mapper type="glob" from="*.po" to="*.mo"/>
</apply>
</target>
</project>
18 changes: 18 additions & 0 deletions languages/template.base.pot
@@ -0,0 +1,18 @@
# Translation for the Csv Import plugin for Omeka.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Omeka package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: CsvImport\n"
"Report-Msgid-Bugs-To: https://github.com/omeka/plugin-CsvImport/issues\n"
"POT-Creation-Date: 2013-03-06 00:06+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\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"

0 comments on commit 31f8685

Please sign in to comment.