Forum: Typo localization in general, Romanian localization file

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
388e305db079d947d7b6fcc753c7d881?d=identicon&s=25 Alex Deva (Guest)
on 2007-05-05 17:43
(Received via mailing list)

A. I'm not sure who to tell about this, but I've created a
localization file in Romanian, and I'd like to make it available for
inclusion in the next release. Will an administrator tell me where to
send my lang/ro_RO.rb please? :)

Incidentally, I've also fixed a few other files whose strings weren't
localized. At the time I'm writing this mail, they are:

I'll keep on patching them. If anyone's interested, I can make them
available too.

B. Another thing which is, in my opinion, not very nice is that there
are some Javascript strings which can't easily be localized using the
_() notation. Among others, that's why you'll always see "x hours
ago" in English, regardless of your configured language.

To fix this, I've done the following 5 steps:

  1. Patched localization.rb by adding:
    def self.all_keys

  2. Added a method in articles_controller.rb:
    def localized_js

        # We only retrieve translations which have to do with the
Javascript strings; we don't want to overload the browser.
      js_content = Localization.all_keys.collect { |key| if key =~ /
^js_(.+)/ ; $1 end }.compact

      render :content_type => 'text/javascript', :text => 'var
LocalizedStrings = {' +
          js_content.collect { |key| lkey="js_#{key}"; "\"#{key}\" :
\"#{_(lkey)}\"" }.join(', ') +
          String.prototype.localize = function() {
                  var s;
                  if(LocalizedStrings && (s=LocalizedStrings[this]) )
return s;
                  return this;

  3. Added a line in the default.rhtml of the active theme (maybe
there's a better place for this, but I couldn't find it yet):
    <script src="/articles/localized_js"

  4. Added translations in the file like this: 'js_hours', 'ore'

  5. In all Javascript code, I replaced strings like this:
    Before: "hours"
    After: "js_hours".localize()

C. In Romanian (and other languages), words used to express time
difference from now (like 'ago' and 'from now') prepend the numeral,
contrary to the English rules. That is why I also had to change some
logic in the function get_local_time_for_date() (file typo.js) and
translate 'ago' and 'from now' as the empty string.

That's it for now. Sorry for sending all this in an email. If an
admin feels I should be submitting these as patches, please tell me
how. I've only been using Typo for a few hours. Thanks!

   Alex Deva
   Indigenious Development
2763d87b1843f2d116e006b6039133a3?d=identicon&s=25 Frederic de Villamil (Guest)
on 2007-05-06 12:25
(Received via mailing list)

For the localization file in .ro, open a ticket on the trac and add
it as an attachment, I'll add it to the trunk after.
For the js change, create a patch, open a ticket on the trac and add
it as an attachment, and maybe I'll add it after a few testing.


Le 5 mai 07 à 17:41, Alex Deva a écrit :

>  vendor/plugins/category_sidebar/views/content.rhtml
>        # We only retrieve translations which have to do with the
>                   var s;
> change some logic in the function get_local_time_for_date() (file
> _______________________________________________
> Typo-list mailing list

Frédéric de Villamil                        tel: +33 (0)6 62 19 1337         Typo :
This topic is locked and can not be replied to.