Skip to content
This repository
Browse code

Added initials test for our locales

  • Loading branch information...
commit 17873849d0a70f4087155b035ece523df10131be 1 parent 2d85bef
Davide D'Agostino authored August 01, 2011
4  padrino-admin/lib/padrino-admin/locale/admin/cz.yml → padrino-admin/lib/padrino-admin/locale/admin/cs.yml
... ...
@@ -1,4 +1,4 @@
1  
-cz:
  1
+cs:
2 2
   padrino:
3 3
     admin:
4 4
       save: Uložit
@@ -13,4 +13,4 @@ cz:
13 13
       all: Všichni
14 14
       profile: Profil
15 15
       settings: Nastavení
16  
-      logout: Odhlásit
  16
+      logout: Odhlásit
4  padrino-admin/lib/padrino-admin/locale/orm/cz.yml → padrino-admin/lib/padrino-admin/locale/orm/cs.yml
... ...
@@ -1,4 +1,4 @@
1  
-cz:
  1
+cs:
2 2
   activemodel: &activemodel
3 3
     errors:
4 4
       messages:
@@ -23,4 +23,4 @@ cz:
23 23
         even: "musí být sudé číslo"
24 24
         record_invalid: "Následující pole obsahují chybně vyplněné údaje: %{errors}"
25 25
         content_type: "nepodporovaný formát souboru"
26  
-  activerecord: *activemodel
  26
+  #activerecord: *activemodel
58  padrino-admin/test/test_locale.rb
... ...
@@ -0,0 +1,58 @@
  1
+require File.expand_path(File.dirname(__FILE__) + '/helper')
  2
+
  3
+class TestAdminApplication < Test::Unit::TestCase
  4
+  Dir[File.expand_path("../../lib/padrino-admin/locale/admin/*.yml", __FILE__)].each do |file|
  5
+    name = File.basename(file, '.yml')
  6
+    should "have a vaild #{name} locale for admin" do
  7
+      base = YAML.load_file(file)
  8
+      base = base[name]['padrino']['admin']
  9
+      assert base.present?
  10
+      assert base['save'].present?
  11
+      assert base['cancel'].present?
  12
+      assert base['list'].present?
  13
+      assert base['edit'].present?
  14
+      assert base['new'].present?
  15
+      assert base['show'].present?
  16
+      assert base['delete'].present?
  17
+      assert base['confirm'].present?
  18
+      assert base['created_at'].present?
  19
+      assert base['all'].present?
  20
+      assert base['profile'].present?
  21
+      assert base['settings'].present?
  22
+      assert base['logout'].present?
  23
+    end
  24
+  end
  25
+
  26
+  Dir[File.expand_path("../../lib/padrino-admin/locale/orm/*.yml", __FILE__)].each do |file|
  27
+    name = File.basename(file, '.yml')
  28
+    should "have a vaild #{name} locale for orm" do
  29
+      base = YAML.load_file(file)
  30
+      # TODO: some one can know why I can't parse YML aliases?
  31
+      %w(activemodel).each do |m|
  32
+        base = base[name][m]['errors']['messages']
  33
+        assert base.present?
  34
+        assert base['inclusion'].present?
  35
+        assert base['exclusion'].present?
  36
+        assert base['invalid'].present?
  37
+        assert base['confirmation'].present?
  38
+        assert base['accepted'].present?
  39
+        assert base['empty'].present?
  40
+        assert base['blank'].present?
  41
+        assert base['too_long'].present?
  42
+        assert base['too_short'].present?
  43
+        assert base['wrong_length'].present?
  44
+        assert base['taken'].present?
  45
+        assert base['not_a_number'].present?
  46
+        assert base['greater_than'].present?
  47
+        assert base['greater_than_or_equal_to'].present?
  48
+        assert base['equal_to'].present?
  49
+        assert base['less_than'].present?
  50
+        assert base['less_than_or_equal_to'].present?
  51
+        assert base['odd'].present?
  52
+        assert base['even'].present?
  53
+        assert base['record_invalid'].present?
  54
+        assert base['content_type'].present?
  55
+      end
  56
+    end
  57
+  end
  58
+end
3  padrino-core/lib/padrino-core/locale/cz.yml → padrino-core/lib/padrino-core/locale/cs.yml
... ...
@@ -1,4 +1,4 @@
1  
-cz:
  1
+cs:
2 2
   date:
3 3
     formats:
4 4
       # Use the strftime parameters for formats.
@@ -7,6 +7,7 @@ cz:
7 7
       default: "%d. %m. %Y"
8 8
       short: "%d %b"
9 9
       long: "%d. %B %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Neděle, Pondělí, Úterý, Středa, Čtvrtek, Pátek, Sobota]
12 13
     abbr_day_names: [Ne, Po, Út, St, Čt, Pá, So]
3  padrino-core/lib/padrino-core/locale/da.yml
@@ -7,6 +7,7 @@ da:
7 7
       default: "%d.%m.%Y"
8 8
       short: "%e. %b %Y"
9 9
       long: "%e. %B %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [søndag, mandag, tirsdag, onsdag, torsdag, fredag, lørdag]
12 13
     abbr_day_names: [sø, ma, ti, 'on', to, fr, lø]
@@ -27,4 +28,4 @@ da:
27 28
     array:
28 29
       words_connector: ", "
29 30
       two_words_connector: " og "
30  
-      last_word_connector: " og "
  31
+      last_word_connector: " og "
3  padrino-core/lib/padrino-core/locale/de.yml
@@ -7,6 +7,7 @@ de:
7 7
       default: "&d.&m.%Y"
8 8
       short: "%b %d"
9 9
       long: "%B %d, %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
12 13
     abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
@@ -27,4 +28,4 @@ de:
27 28
     array:
28 29
       words_connector: ", "
29 30
       two_words_connector: " und "
30  
-      last_word_connector: ", und "
  31
+      last_word_connector: ", und "
3  padrino-core/lib/padrino-core/locale/en.yml
@@ -7,6 +7,7 @@ en:
7 7
       default: "%Y-%m-%d"
8 8
       short: "%b %d"
9 9
       long: "%B %d, %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
12 13
     abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
@@ -27,4 +28,4 @@ en:
27 28
     array:
28 29
       words_connector: ", "
29 30
       two_words_connector: " and "
30  
-      last_word_connector: ", and "
  31
+      last_word_connector: ", and "
3  padrino-core/lib/padrino-core/locale/es.yml
@@ -7,6 +7,7 @@ es:
7 7
       default: "%d-%m-%Y"
8 8
       short: "%b %d"
9 9
       long: "%B %d, %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Domingo, Lunes, Martes, Miércoles, Jueves, Viernes, Sábado]
12 13
     abbr_day_names: [Dom, Lun, Mar, Mie, Jue, Vie, Sab]
@@ -27,4 +28,4 @@ es:
27 28
     array:
28 29
       words_connector: ", "
29 30
       two_words_connector: " y "
30  
-      last_word_connector: ", y "
  31
+      last_word_connector: ", y "
3  padrino-core/lib/padrino-core/locale/fr.yml
@@ -7,6 +7,7 @@ fr:
7 7
       default: "%d-%m-%Y"
8 8
       short: "%b %d"
9 9
       long: "%B %d, %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Dimanche, Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi]
12 13
     abbr_day_names: [Lun, Mar, Mer, Jeu, Ven, Sam, Dim]
@@ -27,4 +28,4 @@ fr:
27 28
     array:
28 29
       words_connector: ", "
29 30
       two_words_connector: " et "
30  
-      last_word_connector: ", et "
  31
+      last_word_connector: ", et "
3  padrino-core/lib/padrino-core/locale/hu.yml
@@ -7,6 +7,7 @@ hu:
7 7
       default: "%Y-%m-%d"
8 8
       short: "%b. %d."
9 9
       long: "%Y. %B %d."
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [vasárnap, hétfő, kedd, szerda, csütörtök, péntek, szombat]
12 13
     abbr_day_names: [vas, hét, kedd, sze, csüt, pén, szo]
@@ -27,4 +28,4 @@ hu:
27 28
     array:
28 29
       words_connector: ", "
29 30
       two_words_connector: " és "
30  
-      last_word_connector: " és "
  31
+      last_word_connector: " és "
1  padrino-core/lib/padrino-core/locale/ja.yml
@@ -7,6 +7,7 @@ ja:
7 7
       default: "%Y/%m/%d"
8 8
       short: "%m/%d"
9 9
       long: "%Y年%m月%d日"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日]
12 13
     abbr_day_names: [日, 月, 火, 水, 木, 金, 土]
3  padrino-core/lib/padrino-core/locale/nl.yml
@@ -7,6 +7,7 @@ nl:
7 7
       default: "%d-%m-%Y"
8 8
       short: "%d %b"
9 9
       long: "%d %B %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [zondag, maandag, dinsdag, woensdag, donderdag, vrijdag, zaterdag]
12 13
     abbr_day_names: [zo, ma, di, wo, do, vr, za]
@@ -27,4 +28,4 @@ nl:
27 28
     array:
28 29
       words_connector: ", "
29 30
       two_words_connector: " en "
30  
-      last_word_connector: " en "
  31
+      last_word_connector: " en "
1  padrino-core/lib/padrino-core/locale/no.yml
@@ -7,6 +7,7 @@
7 7
       default: "%d.%m.%Y"
8 8
       short: "%e. %b %Y"
9 9
       long: "%e. %B %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [søndag, mandag, tirsdag, onsdag, torsdag, fredag, lørdag]
12 13
     abbr_day_names: [sø, ma, ti, 'on', to, fr, lø]
1  padrino-core/lib/padrino-core/locale/pl.yml
@@ -7,6 +7,7 @@ pl:
7 7
       default: "%Y-%m-%d"
8 8
       short: "%d %b"
9 9
       long: "%d %B %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Niedziela, Poniedziałek, Wtorek, Środa, Czwartek, Piątek, Sobota]
12 13
     abbr_day_names: [nie, pon, wto, śro, czw, pia, sob]
2  padrino-core/lib/padrino-core/locale/pt_br.yml
... ...
@@ -1,4 +1,4 @@
1  
-it:
  1
+pt_br:
2 2
   date:
3 3
     formats:
4 4
       # Use the strftime parameters for formats.
1  padrino-core/lib/padrino-core/locale/ru.yml
@@ -7,6 +7,7 @@ ru:
7 7
       default: "%d.%m.%Y"
8 8
       short: "%d %b"
9 9
       long: "%e %B, %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Воскресенье, Понедельник, Вторник, Среда, Четверг, Пятница, Суббота]
12 13
     abbr_day_names: [Вс, Пн, Вт, Ср, Чт, Пт, Сб]
1  padrino-core/lib/padrino-core/locale/tr.yml
@@ -7,6 +7,7 @@ tr:
7 7
       default: "%d/%m/%Y"
8 8
       short: "%d %b"
9 9
       long: "%d %B %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Pazar, Pazartesi, Salı, Çarşamba, Perşembe, Cuma, Cumartesi]
12 13
     abbr_day_names: [Paz, Pts, Sal, Çar, Per, Cum, Cts]
1  padrino-core/lib/padrino-core/locale/uk.yml
@@ -7,6 +7,7 @@ uk:
7 7
       default: "%d.%m.%Y"
8 8
       short: "%d %b"
9 9
       long: "%e %B, %Y"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [Неділя, Понеділок, Вівторок, Середа, Четвер, Пятница, Субота]
12 13
     abbr_day_names: [Нд, Пн, Вт, Ср, Чт, Пт, Сб]
1  padrino-core/lib/padrino-core/locale/zh_cn.yml
@@ -7,6 +7,7 @@ zh_cn:
7 7
       default: "%Y-%m-%d"
8 8
       short: "%b%d日"
9 9
       long: "%Y年%b%d日"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
12 13
     abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
1  padrino-core/lib/padrino-core/locale/zh_tw.yml
@@ -7,6 +7,7 @@ zh_tw:
7 7
       default: "%Y-%m-%d"
8 8
       short: "%b%d日"
9 9
       long: "%Y年%b%d日"
  10
+      only_day: "%e"
10 11
 
11 12
     day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
12 13
     abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
21  padrino-core/test/test_locale.rb
... ...
@@ -0,0 +1,21 @@
  1
+require File.expand_path(File.dirname(__FILE__) + '/helper')
  2
+
  3
+class TestFilters < Test::Unit::TestCase 
  4
+  Dir[File.expand_path("../../lib/padrino-core/locale/*.yml", __FILE__)].each do |file|
  5
+    base_original = YAML.load_file(file)
  6
+    name = File.basename(file, '.yml')
  7
+    should "should have correct locale for #{name}" do
  8
+      base = base_original[name]['date']['formats']
  9
+      assert base['default'].present?
  10
+      assert base['short'].present?
  11
+      assert base['long'].present?
  12
+      assert base['only_day'].present?
  13
+      base = base_original[name]['date']
  14
+      assert base['day_names'].present?
  15
+      assert base['abbr_day_names'].present?
  16
+      assert base['month_names'].present?
  17
+      assert base['abbr_month_names'].present?
  18
+      assert base['order'].present?
  19
+    end
  20
+  end
  21
+end

1 note on commit 1787384

Nathan Esquenazi
Owner

Good idea adding tests. Thanks

Please sign in to comment.
Something went wrong with that request. Please try again.