From b6108f3c8d9033375aaa5c5fce0d71bc839dad21 Mon Sep 17 00:00:00 2001 From: Larissa Reis Date: Mon, 19 Jan 2015 10:32:18 -0300 Subject: [PATCH] Moves custom_locales to config/custom_locales --- INSTALL.locales.md | 29 +++++++++++++++-------------- lib/noosfero/i18n.rb | 4 ++-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/INSTALL.locales.md b/INSTALL.locales.md index ae32bd2..8c59b72 100644 --- a/INSTALL.locales.md +++ b/INSTALL.locales.md @@ -1,8 +1,8 @@ Using custom locales ==================== -Personalized translations go into the `custom_locales/` directory. Custom -locales can be identified by the rails environment, schema name in a +Personalized translations go into the `config/custom_locales/` directory. +Custom locales can be identified by the rails environment, schema name in a multitenancy setup or domain name until the first dot (e.g env1.coop.br for the example below). @@ -13,16 +13,17 @@ processed is "environment". For instance, a POT file would be called The structure of an environment named env1 with custom translations for both Portuguese and Spanish and an environment named env2 with custom Russian translation would be: - - custom_locales/ - env1/ - environment.pot - pt/ - environment.po - es/ - environment.po - env2/ - environment.pot - ru/ - environment.po + + config/ + custom_locales/ + env1/ + environment.pot + pt/ + environment.po + es/ + environment.po + env2/ + environment.pot + ru/ + environment.po diff --git a/lib/noosfero/i18n.rb b/lib/noosfero/i18n.rb index 48f2d63..92f8846 100644 --- a/lib/noosfero/i18n.rb +++ b/lib/noosfero/i18n.rb @@ -8,7 +8,7 @@ end # Adds custom locales for a whole environment -custom_locale_dir = Rails.root.join('custom_locales', Rails.env) +custom_locale_dir = Rails.root.join('config', 'custom_locales', Rails.env) repos = [] if File.exists?(custom_locale_dir) repos << FastGettext::TranslationRepository.build('environment', :type => 'po', :path => custom_locale_dir) @@ -30,7 +30,7 @@ hosted_environments = Noosfero::MultiTenancy.mapping.values hosted_environments += Domain.all.map { |domain| domain.name[/(.*?)\./,1] } if Domain.table_exists? hosted_environments.uniq.each do |env| - custom_locale_dir = Rails.root.join('custom_locales', env) + custom_locale_dir = Rails.root.join('config', 'custom_locales', env) if File.exists?(custom_locale_dir) FastGettext.add_text_domain(env, :type => :chain, :chain => [FastGettext::TranslationRepository.build('environment', :type => 'po', :path => custom_locale_dir)] + repos) end -- libgit2 0.21.2