Commit 1422a69b6f86e89f2a77121c864808a5711bfbcc

Authored by Antonio Terceiro
Committed by Daniela Feitosa
1 parent 534114b8

Re-introduce possibility of setting locales list

Signed-off-by: Daniela Soares Feitosa <danielafeitosa@colivre.coop.br>
Showing 2 changed files with 13 additions and 1 deletions   Show diff stats
lib/noosfero.rb
... ... @@ -10,7 +10,7 @@ module Noosfero
10 10  
11 11 class << self
12 12 def locales
13   - {
  13 + @locales ||= {
14 14 'en' => 'English',
15 15 'pt' => 'Português',
16 16 'fr' => 'Français',
... ... @@ -21,6 +21,7 @@ module Noosfero
21 21 'eo' => 'Esperanto'
22 22 }
23 23 end
  24 + attr_writer :locales
24 25 attr_accessor :default_locale
25 26 def available_locales
26 27 @available_locales ||=
... ...
test/unit/noosfero_test.rb
... ... @@ -84,4 +84,15 @@ class NoosferoTest &lt; ActiveSupport::TestCase
84 84 assert_equal 'localhost', Noosfero.default_hostname
85 85 end
86 86  
  87 + should 'be able to override locales' do
  88 + original_locales = Noosfero.locales
  89 +
  90 + english_only = { 'en' => 'English' }
  91 + Noosfero.locales = english_only
  92 + assert_equal english_only, Noosfero.locales
  93 +
  94 + # cleanup
  95 + Noosfero.locales = original_locales
  96 + end
  97 +
87 98 end
... ...