[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: i18n of moderation.rb actions

From: boud
Subject: PATCH: i18n of moderation.rb actions
Date: Sun, 25 Mar 2007 23:41:21 +0200 (CEST)

hi samizdat-devel,

<proud-newbie>i think this time i found a way to solve a problem which
uses the full elegance of gettext and ruby and samizdat: only 10
characters need to be added :).</proud-newbie>

PROBLEM:  /moderation.rb  shows the actions - hide, unhide, takeover, ...
in English, not in the user's preferred language.

SOLUTION: Solution without requiring any additions to the .po files - convert to upper case with .upcase and then use getttext with _( ), since
the translation strings are already defined for the .po files:

--- old/usr/share/samizdat/cgi-bin/moderation.rb  2007-02-18 19:17:52.000000000 
+++ /usr/share/samizdat/cgi-bin/moderation.rb   2007-03-25 23:17:31.082118224 
@@ -27,7 +27,8 @@
       t.resource_href(moderator,, moderator).render(:title)),
-      action,
+#      action,
+       _(action.upcase),, resource).render(:list)

COMMENT: Even more elegant might be something like:


except that from what is said about ruby-1.6 about .upcase
and from my experimenting with ruby-1.8, it seems that this will
fail any any non-ascii characters - in which case it would clearly be
a bad idea.   Functions for upcasing non-ascii character sets (which
have the notion of upper and lower case) definitely exist in emacs :),
but i'm not going to look them up and port them to samizdat...

So IMHO  _(action.upcase)  should be enough.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]