Hi,

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:
 vendor/plugins/xml_sidebar/views/content.rhtml
 vendor/plugins/category_sidebar/views/content.rhtml
 app/helpers/articles_helper.rb
 views/shared/_search.rhtml

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
                        @@l10s[lang].keys
                end

        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;
                }'
          end

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" 
type="text/javascript"></script>

        4. Added translations in the file like this:
                l.store '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
  www.indigenious.ro



_______________________________________________
Typo-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/typo-list

Reply via email to