[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
+0100
+++ /usr/share/samizdat/cgi-bin/moderation.rb 2007-03-25 23:17:31.082118224
+0200
@@ -27,7 +27,8 @@
t.format_date(date),
t.resource_href(moderator,
Resource.new(session, moderator).render(:title)),
- action,
+# action,
+ _(action.upcase),
Resource.new(session, resource).render(:list)
]
}
COMMENT: Even more elegant might be something like:
(_(action.upcase)).capitalize
except that from what is said about ruby-1.6 about .upcase
http://rubycentral.com/book/ref_c_string.html#String.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.
cheers
boud
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- PATCH: i18n of moderation.rb actions,
boud <=