[Jifty-commit] r780 - in jifty/trunk: . lib lib/Jifty
lib/Jifty/Script share/web/templates
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Mar 31 04:24:20 EST 2006
Author: jesse
Date: Fri Mar 31 04:24:19 2006
New Revision: 780
Added:
jifty/trunk/share/po/
jifty/trunk/share/po/en.po
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty.pm
jifty/trunk/lib/Jifty/Everything.pm
jifty/trunk/lib/Jifty/I18N.pm
jifty/trunk/lib/Jifty/Script.pm
jifty/trunk/lib/Jifty/Script/Help.pm
jifty/trunk/share/web/templates/index.html
Log:
r10658 at hualien: jesse | 2006-03-31 18:23:18 +0900
* First working pass of internationalization
Modified: jifty/trunk/lib/Jifty.pm
==============================================================================
--- jifty/trunk/lib/Jifty.pm (original)
+++ jifty/trunk/lib/Jifty.pm Fri Mar 31 04:24:19 2006
@@ -103,7 +103,7 @@
# Load the configuration. stash it in ->config
__PACKAGE__->config( Jifty::Config->new() );
- require Jifty::I18N; # can't do this before we have the config set up
+ Jifty::I18N->new(); # can't do this before we have the config set up
# Now that we've loaded the configuration, we can remove the temporary
Modified: jifty/trunk/lib/Jifty/Everything.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Everything.pm (original)
+++ jifty/trunk/lib/Jifty/Everything.pm Fri Mar 31 04:24:19 2006
@@ -10,6 +10,7 @@
=cut
use Jifty ();
+use Jifty::I18N ();
use Jifty::Dispatcher ();
use Jifty::Object ();
use Jifty::Config ();
Modified: jifty/trunk/lib/Jifty/I18N.pm
==============================================================================
--- jifty/trunk/lib/Jifty/I18N.pm (original)
+++ jifty/trunk/lib/Jifty/I18N.pm Fri Mar 31 04:24:19 2006
@@ -2,6 +2,8 @@
use warnings;
package Jifty::I18N;
+use base 'Locale::Maketext';
+use Locale::Maketext::Lexicon ();
=head1 NAME
@@ -18,13 +20,32 @@
=cut
-use Locale::Maketext::Simple (
- Path => [Jifty->config->framework('PoDir'), Jifty->config->framework('DefaultPoDir')],
- Style => 'gettext',
- Decode => 1,
-);
-
-# Allow _() everywhere to loc
-*_ = \&loc;
+sub new {
+ my $class = shift;
+ my $self = {};
+ bless $self, $class;
+
+ Locale::Maketext::Lexicon->import(
+ {
+ '*' => [
+ Gettext => Jifty->config->framework('L10N')->{'PoDir'} . '/*.po',
+ Gettext => Jifty->config->framework('L10N')->{'DefaultPoDir'} . '/*.po'
+ ],
+
+ _decode => 1,
+ }
+ );
+
+ $Jifty::I18N::en::Lexicon{_AUTO} = 1; # autocreate missing keys
+ $self->init;
+
+ my $lh = eval { $class->get_handle };
+ my $loc_method = sub { $lh->maketext(@_); };
+ no strict 'refs';
+ *{ caller(0) . "::loc" } = $loc_method;
+ *_ = \&{ caller(0) . "::loc" };
+ warn "here for " . caller(0);
+ return $self;
+}
1;
Modified: jifty/trunk/lib/Jifty/Script.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script.pm (original)
+++ jifty/trunk/lib/Jifty/Script.pm Fri Mar 31 04:24:19 2006
@@ -1,6 +1,5 @@
package Jifty::Script;
use base qw/App::CLI App::CLI::Command/;
-use Jifty::I18N;
=head2 prepare
Modified: jifty/trunk/lib/Jifty/Script/Help.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Help.pm (original)
+++ jifty/trunk/lib/Jifty/Script/Help.pm Fri Mar 31 04:24:19 2006
@@ -2,7 +2,6 @@
use strict;
use base qw( App::CLI::Command::Help );
use File::Find qw(find);
-use Jifty::I18N;
sub help_base {
return "Jifty::Manual";
Added: jifty/trunk/share/po/en.po
==============================================================================
--- (empty file)
+++ jifty/trunk/share/po/en.po Fri Mar 31 04:24:19 2006
@@ -0,0 +1,25 @@
+# English translation of PACKAGE.
+# Copyright (C) 2006 Free Software Foundation, Inc.
+# <>, 2006.
+#
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2006-03-31 17:41+0900\n"
+"PO-Revision-Date: 2006-03-31 17:42+0900\n"
+"Last-Translator: <>\n"
+"Language-Team: English <en at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: "
+
+msgid ""
+msgstr ""
+
+#
+msgid "Jifty"
+msgstr "Jifty"
+
Modified: jifty/trunk/share/web/templates/index.html
==============================================================================
--- jifty/trunk/share/web/templates/index.html (original)
+++ jifty/trunk/share/web/templates/index.html Fri Mar 31 04:24:19 2006
@@ -1,3 +1,5 @@
-<&|/_elements/wrapper, title => 'Welcome to your new Jifty application' &>
+<&|/_elements/wrapper, title => _('Welcome to your new Jifty application') &>
<img src="/static/images/pony.jpg" alt="You said you wanted a pony. (Source http://hdl.loc.gov/loc.pnp/cph.3c13461)" />
+
+<%_('Pony')%>
</&>
More information about the Jifty-commit
mailing list