gettext_simple_rails 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gettext_simple_rails/cache_handler.rb +5 -3
  3. data/lib/gettext_simple_rails/i18n_injector.rb +7 -65
  4. data/lib/gettext_simple_rails/translators/active_record_attributes_translator.rb +36 -0
  5. data/lib/gettext_simple_rails/translators/{active_record_translator.rb → active_record_validations_translator.rb} +5 -3
  6. data/lib/gettext_simple_rails/translators/globalize_translator.rb +32 -0
  7. data/lib/gettext_simple_rails/version.rb +1 -1
  8. data/lib/tasks/gettext_simple_rails_tasks.rake +0 -42
  9. data/spec/{active_record_spec.rb → active_record_validations_spec.rb} +2 -2
  10. data/spec/dummy/app/models/user.rb +2 -1
  11. data/spec/dummy/config/application.rb +1 -0
  12. data/spec/dummy/config/locales_gettext/static_translation_file.json +1 -1
  13. data/spec/dummy/db/migrate/20140515092420_create_user_translations.rb +11 -0
  14. data/spec/dummy/db/schema.rb +9 -5
  15. data/spec/dummy/db/test.sqlite3 +0 -0
  16. data/spec/dummy/lib/gettext_simple_rails/active_record_attributes_translator_translations.rb +40 -0
  17. data/spec/dummy/lib/gettext_simple_rails/active_record_validations_translator_translations.rb +18 -0
  18. data/spec/dummy/lib/gettext_simple_rails/date_translator_translations.rb +60 -0
  19. data/spec/dummy/lib/gettext_simple_rails/globalize_translator_translations.rb +6 -0
  20. data/spec/dummy/lib/gettext_simple_rails/number_translator_translations.rb +48 -0
  21. data/spec/dummy/log/test.log +440 -0
  22. data/spec/gettext_simple_rails_spec.rb +10 -11
  23. data/spec/globalize_translator_spec.rb +20 -0
  24. metadata +35 -13
  25. data/spec/dummy/db/development.sqlite3 +0 -0
  26. data/spec/dummy/lib/gettext_simple_rails/models/role_model_translations.rb +0 -21
  27. data/spec/dummy/lib/gettext_simple_rails/models/user_model_translations.rb +0 -22
  28. data/spec/dummy/log/development.log +0 -26
@@ -535,3 +535,443 @@
535
535
   (0.1ms) rollback transaction
536
536
   (0.0ms) begin transaction
537
537
   (0.0ms) rollback transaction
538
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
539
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
540
+  (0.1ms) begin transaction
541
+  (0.2ms) rollback transaction
542
+  (0.2ms) begin transaction
543
+  (0.2ms) rollback transaction
544
+  (0.2ms) begin transaction
545
+  (0.1ms) rollback transaction
546
+  (0.0ms) begin transaction
547
+  (0.1ms) rollback transaction
548
+  (0.0ms) begin transaction
549
+  (0.1ms) rollback transaction
550
+  (0.0ms) begin transaction
551
+  (0.1ms) rollback transaction
552
+  (0.0ms) begin transaction
553
+  (0.1ms) rollback transaction
554
+  (0.0ms) begin transaction
555
+  (0.1ms) rollback transaction
556
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
557
+  (0.1ms) begin transaction
558
+  (0.0ms) rollback transaction
559
+  (0.0ms) begin transaction
560
+  (0.0ms) rollback transaction
561
+  (0.1ms) begin transaction
562
+  (0.1ms) rollback transaction
563
+  (0.0ms) begin transaction
564
+  (0.1ms) rollback transaction
565
+  (0.0ms) begin transaction
566
+  (0.0ms) rollback transaction
567
+  (0.0ms) begin transaction
568
+  (0.0ms) rollback transaction
569
+  (0.1ms) begin transaction
570
+  (0.1ms) rollback transaction
571
+  (0.1ms) begin transaction
572
+  (0.1ms) rollback transaction
573
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
574
+ Migrating to CreateUserTranslations (20140515092420)
575
+  (0.1ms) begin transaction
576
+  (0.3ms) CREATE TABLE "user_translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "locale" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
577
+  (0.1ms) ALTER TABLE "user_translations" ADD "title" varchar(255)
578
+  (0.1ms) CREATE INDEX "index_user_translations_on_user_id" ON "user_translations" ("user_id")
579
+  (0.1ms) CREATE INDEX "index_user_translations_on_locale" ON "user_translations" ("locale")
580
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140515092420"]]
581
+  (113.7ms) commit transaction
582
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
583
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
584
+  (0.1ms) begin transaction
585
+  (0.1ms) rollback transaction
586
+  (0.0ms) begin transaction
587
+  (0.0ms) rollback transaction
588
+  (0.0ms) begin transaction
589
+  (0.3ms) rollback transaction
590
+  (0.2ms) begin transaction
591
+  (0.1ms) rollback transaction
592
+  (0.0ms) begin transaction
593
+  (0.1ms) rollback transaction
594
+  (0.0ms) begin transaction
595
+  (0.1ms) rollback transaction
596
+  (0.1ms) begin transaction
597
+  (0.3ms) rollback transaction
598
+  (0.2ms) begin transaction
599
+  (0.1ms) rollback transaction
600
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
601
+  (0.1ms) begin transaction
602
+  (0.1ms) rollback transaction
603
+  (0.0ms) begin transaction
604
+  (0.1ms) rollback transaction
605
+  (0.0ms) begin transaction
606
+  (0.1ms) rollback transaction
607
+  (0.1ms) begin transaction
608
+  (0.1ms) rollback transaction
609
+  (0.0ms) begin transaction
610
+  (0.1ms) rollback transaction
611
+  (0.0ms) begin transaction
612
+  (0.3ms) rollback transaction
613
+  (0.2ms) begin transaction
614
+  (0.2ms) rollback transaction
615
+  (0.2ms) begin transaction
616
+  (0.2ms) rollback transaction
617
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
618
+  (0.1ms) begin transaction
619
+  (0.1ms) rollback transaction
620
+  (0.0ms) begin transaction
621
+  (0.3ms) rollback transaction
622
+  (0.2ms) begin transaction
623
+  (0.1ms) rollback transaction
624
+  (0.0ms) begin transaction
625
+  (0.1ms) rollback transaction
626
+  (0.0ms) begin transaction
627
+  (0.1ms) rollback transaction
628
+  (0.1ms) begin transaction
629
+  (0.0ms) rollback transaction
630
+  (0.0ms) begin transaction
631
+  (0.0ms) rollback transaction
632
+  (0.0ms) begin transaction
633
+  (0.1ms) rollback transaction
634
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
635
+  (0.1ms) begin transaction
636
+  (0.0ms) rollback transaction
637
+  (0.0ms) begin transaction
638
+  (0.1ms) rollback transaction
639
+  (0.0ms) begin transaction
640
+  (0.3ms) rollback transaction
641
+  (0.2ms) begin transaction
642
+  (0.2ms) rollback transaction
643
+  (0.2ms) begin transaction
644
+  (0.2ms) rollback transaction
645
+  (0.2ms) begin transaction
646
+  (0.1ms) rollback transaction
647
+  (0.0ms) begin transaction
648
+  (0.1ms) rollback transaction
649
+  (0.0ms) begin transaction
650
+  (0.1ms) rollback transaction
651
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
652
+  (0.1ms) begin transaction
653
+  (0.1ms) rollback transaction
654
+  (0.0ms) begin transaction
655
+  (0.1ms) rollback transaction
656
+  (0.0ms) begin transaction
657
+  (0.3ms) rollback transaction
658
+  (0.2ms) begin transaction
659
+  (0.1ms) rollback transaction
660
+  (0.0ms) begin transaction
661
+  (0.1ms) rollback transaction
662
+  (0.0ms) begin transaction
663
+  (0.3ms) rollback transaction
664
+  (0.2ms) begin transaction
665
+  (0.2ms) rollback transaction
666
+  (0.2ms) begin transaction
667
+  (0.2ms) rollback transaction
668
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
669
+  (0.1ms) begin transaction
670
+  (0.0ms) rollback transaction
671
+  (0.0ms) begin transaction
672
+  (0.1ms) rollback transaction
673
+  (0.0ms) begin transaction
674
+  (0.3ms) rollback transaction
675
+  (0.2ms) begin transaction
676
+  (0.1ms) rollback transaction
677
+  (0.0ms) begin transaction
678
+  (0.1ms) rollback transaction
679
+  (0.0ms) begin transaction
680
+  (0.1ms) rollback transaction
681
+  (0.0ms) begin transaction
682
+  (0.0ms) rollback transaction
683
+  (0.0ms) begin transaction
684
+  (0.1ms) rollback transaction
685
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
686
+  (0.1ms) begin transaction
687
+  (0.1ms) rollback transaction
688
+  (0.0ms) begin transaction
689
+  (0.1ms) rollback transaction
690
+  (0.0ms) begin transaction
691
+  (0.1ms) rollback transaction
692
+  (0.0ms) begin transaction
693
+  (0.3ms) rollback transaction
694
+  (0.2ms) begin transaction
695
+  (0.1ms) rollback transaction
696
+  (0.0ms) begin transaction
697
+  (0.1ms) rollback transaction
698
+  (0.0ms) begin transaction
699
+  (0.0ms) rollback transaction
700
+  (0.0ms) begin transaction
701
+  (0.0ms) rollback transaction
702
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
703
+  (0.1ms) begin transaction
704
+  (0.0ms) rollback transaction
705
+  (0.0ms) begin transaction
706
+  (0.1ms) rollback transaction
707
+  (0.0ms) begin transaction
708
+  (0.1ms) rollback transaction
709
+  (0.1ms) begin transaction
710
+  (0.1ms) rollback transaction
711
+  (0.0ms) begin transaction
712
+  (0.2ms) rollback transaction
713
+  (0.2ms) begin transaction
714
+  (0.1ms) rollback transaction
715
+  (0.0ms) begin transaction
716
+  (0.0ms) rollback transaction
717
+  (0.1ms) begin transaction
718
+  (0.0ms) rollback transaction
719
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
720
+  (0.1ms) begin transaction
721
+  (0.3ms) rollback transaction
722
+  (0.2ms) begin transaction
723
+  (0.1ms) rollback transaction
724
+  (0.0ms) begin transaction
725
+  (0.1ms) rollback transaction
726
+  (0.0ms) begin transaction
727
+  (0.0ms) rollback transaction
728
+  (0.0ms) begin transaction
729
+  (0.1ms) rollback transaction
730
+  (0.1ms) begin transaction
731
+  (0.1ms) rollback transaction
732
+  (0.0ms) begin transaction
733
+  (0.1ms) rollback transaction
734
+  (0.0ms) begin transaction
735
+  (0.1ms) rollback transaction
736
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
737
+  (0.1ms) begin transaction
738
+  (0.0ms) rollback transaction
739
+  (0.1ms) begin transaction
740
+  (0.1ms) rollback transaction
741
+  (0.0ms) begin transaction
742
+  (0.1ms) rollback transaction
743
+  (0.0ms) begin transaction
744
+  (0.0ms) rollback transaction
745
+  (0.0ms) begin transaction
746
+  (0.1ms) rollback transaction
747
+  (0.1ms) begin transaction
748
+  (0.1ms) rollback transaction
749
+  (0.0ms) begin transaction
750
+  (0.1ms) rollback transaction
751
+  (0.1ms) begin transaction
752
+  (0.3ms) rollback transaction
753
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
754
+  (0.1ms) begin transaction
755
+  (0.0ms) rollback transaction
756
+  (0.0ms) begin transaction
757
+  (0.0ms) rollback transaction
758
+  (0.0ms) begin transaction
759
+  (0.1ms) rollback transaction
760
+  (0.0ms) begin transaction
761
+  (0.1ms) rollback transaction
762
+  (0.0ms) begin transaction
763
+  (0.1ms) rollback transaction
764
+  (0.0ms) begin transaction
765
+  (0.3ms) rollback transaction
766
+  (0.2ms) begin transaction
767
+  (0.1ms) rollback transaction
768
+  (0.0ms) begin transaction
769
+  (0.1ms) rollback transaction
770
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
771
+  (0.1ms) begin transaction
772
+  (0.3ms) rollback transaction
773
+  (0.2ms) begin transaction
774
+  (0.1ms) rollback transaction
775
+  (0.1ms) begin transaction
776
+  (0.1ms) rollback transaction
777
+  (0.0ms) begin transaction
778
+  (0.1ms) rollback transaction
779
+  (0.0ms) begin transaction
780
+  (0.1ms) rollback transaction
781
+  (0.1ms) begin transaction
782
+  (0.1ms) rollback transaction
783
+  (0.0ms) begin transaction
784
+  (0.0ms) rollback transaction
785
+  (0.0ms) begin transaction
786
+  (0.0ms) rollback transaction
787
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
788
+  (0.1ms) begin transaction
789
+  (0.0ms) rollback transaction
790
+  (0.0ms) begin transaction
791
+  (0.1ms) rollback transaction
792
+  (0.1ms) begin transaction
793
+  (0.3ms) rollback transaction
794
+  (0.2ms) begin transaction
795
+  (0.1ms) rollback transaction
796
+  (0.0ms) begin transaction
797
+  (0.1ms) rollback transaction
798
+  (0.0ms) begin transaction
799
+  (0.0ms) rollback transaction
800
+  (0.0ms) begin transaction
801
+  (0.0ms) rollback transaction
802
+  (0.0ms) begin transaction
803
+  (0.1ms) rollback transaction
804
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
805
+  (0.1ms) begin transaction
806
+  (0.1ms) rollback transaction
807
+  (0.0ms) begin transaction
808
+  (0.1ms) rollback transaction
809
+  (0.0ms) begin transaction
810
+  (0.3ms) rollback transaction
811
+  (0.2ms) begin transaction
812
+  (0.1ms) rollback transaction
813
+  (0.0ms) begin transaction
814
+  (0.1ms) rollback transaction
815
+  (0.0ms) begin transaction
816
+  (0.1ms) rollback transaction
817
+  (0.0ms) begin transaction
818
+  (0.0ms) rollback transaction
819
+  (0.0ms) begin transaction
820
+  (0.0ms) rollback transaction
821
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
822
+  (0.1ms) begin transaction
823
+  (0.1ms) rollback transaction
824
+  (0.1ms) begin transaction
825
+  (0.1ms) rollback transaction
826
+  (0.0ms) begin transaction
827
+  (0.3ms) rollback transaction
828
+  (0.2ms) begin transaction
829
+  (0.1ms) rollback transaction
830
+  (0.0ms) begin transaction
831
+  (0.1ms) rollback transaction
832
+  (0.0ms) begin transaction
833
+  (0.1ms) rollback transaction
834
+  (0.1ms) begin transaction
835
+  (0.0ms) rollback transaction
836
+  (0.0ms) begin transaction
837
+  (0.1ms) rollback transaction
838
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
839
+  (0.1ms) begin transaction
840
+  (0.1ms) rollback transaction
841
+  (0.0ms) begin transaction
842
+  (0.3ms) rollback transaction
843
+  (0.3ms) begin transaction
844
+  (0.1ms) rollback transaction
845
+  (0.0ms) begin transaction
846
+  (0.1ms) rollback transaction
847
+  (0.0ms) begin transaction
848
+  (0.1ms) rollback transaction
849
+  (0.0ms) begin transaction
850
+  (0.1ms) rollback transaction
851
+  (0.0ms) begin transaction
852
+  (0.0ms) rollback transaction
853
+  (0.0ms) begin transaction
854
+  (0.0ms) rollback transaction
855
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
856
+  (0.1ms) begin transaction
857
+  (0.1ms) rollback transaction
858
+  (0.0ms) begin transaction
859
+  (0.1ms) rollback transaction
860
+  (0.0ms) begin transaction
861
+  (0.1ms) rollback transaction
862
+  (0.1ms) begin transaction
863
+  (0.3ms) rollback transaction
864
+  (0.2ms) begin transaction
865
+  (0.2ms) rollback transaction
866
+  (0.2ms) begin transaction
867
+  (0.2ms) rollback transaction
868
+  (0.0ms) begin transaction
869
+  (0.1ms) rollback transaction
870
+  (0.1ms) begin transaction
871
+  (0.1ms) rollback transaction
872
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
873
+  (0.1ms) begin transaction
874
+  (0.1ms) rollback transaction
875
+  (0.0ms) begin transaction
876
+  (0.1ms) rollback transaction
877
+  (0.1ms) begin transaction
878
+  (0.1ms) rollback transaction
879
+  (0.0ms) begin transaction
880
+  (0.1ms) rollback transaction
881
+  (0.0ms) begin transaction
882
+  (0.1ms) rollback transaction
883
+  (0.1ms) begin transaction
884
+  (0.3ms) rollback transaction
885
+  (0.2ms) begin transaction
886
+  (0.2ms) rollback transaction
887
+  (0.2ms) begin transaction
888
+  (0.2ms) rollback transaction
889
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
890
+  (0.1ms) begin transaction
891
+  (0.1ms) rollback transaction
892
+  (0.0ms) begin transaction
893
+  (0.1ms) rollback transaction
894
+  (0.0ms) begin transaction
895
+  (0.1ms) rollback transaction
896
+  (0.1ms) begin transaction
897
+  (0.1ms) rollback transaction
898
+  (0.0ms) begin transaction
899
+  (0.1ms) rollback transaction
900
+  (0.0ms) begin transaction
901
+  (0.3ms) rollback transaction
902
+  (0.2ms) begin transaction
903
+  (0.2ms) rollback transaction
904
+  (0.2ms) begin transaction
905
+  (0.2ms) rollback transaction
906
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
907
+  (0.1ms) begin transaction
908
+  (0.3ms) rollback transaction
909
+  (0.2ms) begin transaction
910
+  (0.1ms) rollback transaction
911
+  (0.0ms) begin transaction
912
+  (0.1ms) rollback transaction
913
+  (0.0ms) begin transaction
914
+  (0.1ms) rollback transaction
915
+  (0.0ms) begin transaction
916
+  (0.0ms) rollback transaction
917
+  (0.0ms) begin transaction
918
+  (0.0ms) rollback transaction
919
+  (0.0ms) begin transaction
920
+  (0.1ms) rollback transaction
921
+  (0.1ms) begin transaction
922
+  (0.1ms) rollback transaction
923
+  (0.1ms) begin transaction
924
+  (0.1ms) rollback transaction
925
+  (0.0ms) begin transaction
926
+  (0.0ms) rollback transaction
927
+  (0.0ms) begin transaction
928
+  (0.0ms) rollback transaction
929
+  (0.0ms) begin transaction
930
+  (0.1ms) rollback transaction
931
+  (0.0ms) begin transaction
932
+  (0.0ms) rollback transaction
933
+  (0.0ms) begin transaction
934
+  (0.0ms) rollback transaction
935
+  (0.0ms) begin transaction
936
+  (0.0ms) rollback transaction
937
+  (0.0ms) begin transaction
938
+  (0.0ms) rollback transaction
939
+  (97.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
940
+  (114.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
941
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
942
+ Migrating to CreateUsers (20140410170418)
943
+  (0.0ms) begin transaction
944
+  (0.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "birthday_at" date, "age" integer, "created_at" datetime, "updated_at" datetime) 
945
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140410170418"]]
946
+  (118.6ms) commit transaction
947
+ Migrating to CreateRoles (20140411112622)
948
+  (0.2ms) begin transaction
949
+  (0.8ms) CREATE TABLE "roles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "role" varchar(255), "user_id" integer, "created_at" datetime, "updated_at" datetime) 
950
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140411112622"]]
951
+  (75.6ms) commit transaction
952
+ Migrating to CreateUserTranslations (20140515092420)
953
+  (0.2ms) begin transaction
954
+  (0.3ms) CREATE TABLE "user_translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "locale" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
955
+  (0.1ms) ALTER TABLE "user_translations" ADD "title" varchar(255)
956
+  (0.1ms) CREATE INDEX "index_user_translations_on_user_id" ON "user_translations" ("user_id")
957
+  (0.1ms) CREATE INDEX "index_user_translations_on_locale" ON "user_translations" ("locale")
958
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140515092420"]]
959
+  (132.5ms) commit transaction
960
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
961
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
962
+  (0.1ms) begin transaction
963
+  (0.1ms) rollback transaction
964
+  (0.0ms) begin transaction
965
+  (0.3ms) rollback transaction
966
+  (0.2ms) begin transaction
967
+  (0.1ms) rollback transaction
968
+  (0.0ms) begin transaction
969
+  (0.1ms) rollback transaction
970
+  (0.0ms) begin transaction
971
+  (0.1ms) rollback transaction
972
+  (0.0ms) begin transaction
973
+  (0.0ms) rollback transaction
974
+  (0.0ms) begin transaction
975
+  (0.0ms) rollback transaction
976
+  (0.0ms) begin transaction
977
+  (0.1ms) rollback transaction
@@ -10,24 +10,24 @@ describe GettextSimpleRails do
10
10
  FileUtils.rm_r(GettextSimpleRails.translation_dir) if File.exists?(GettextSimpleRails.translation_dir)
11
11
 
12
12
  # Generate model translations so we can check them.
13
- ::Rake::Task["gettext_simple_rails:generate_model_translation_files"].execute
13
+ ::Rake::Task["gettext_simple_rails:generate_translator_files"].execute
14
14
  end
15
15
 
16
16
  it "generates model translations" do
17
- user_model_translations_path = "#{GettextSimpleRails.translation_dir}/models/user_model_translations.rb"
17
+ user_model_translations_path = "#{GettextSimpleRails.translation_dir}/active_record_attributes_translator_translations.rb"
18
18
  assert File.exists?(user_model_translations_path), "a file with user model translations should have been created but wasn't."
19
19
  content = File.read(user_model_translations_path)
20
20
 
21
- assert content.include?("puts _('models.name.user.one')"), "should include model name"
22
- assert content.include?("puts _('models.name.user.other')"), "should include model name"
21
+ content.should include "_('activerecord.models.user.one')"
22
+ content.should include "_('activerecord.models.user.other')"
23
23
 
24
24
  attributes = ["id", "name", "birthday_at", "age", "created_at", "updated_at"]
25
25
  attributes.each do |attribute|
26
- assert content.include?("puts _('models.attributes.user.#{attribute}')"), "should include attribute #{attribute}"
26
+ content.should include "_('activerecord.attributes.user.#{attribute}')"
27
27
  end
28
28
 
29
29
  # Relationship translations.
30
- assert content.include?("puts _('models.attributes.user.roles')"), "didn't contain relationship translations"
30
+ assert content.include?("_('activerecord.attributes.user.roles')"), "didn't contain relationship translations"
31
31
  end
32
32
 
33
33
  it "can inject the translations into I18n" do
@@ -37,13 +37,12 @@ describe GettextSimpleRails do
37
37
  locales["da"] = {}
38
38
  locales["en"] = {}
39
39
 
40
- gs.__send__(:add_translation, "da", "models.name.user.one", "Bruger")
41
- gs.__send__(:add_translation, "da", "models.name.user.other", "Brugere")
42
-
43
- gs.__send__(:add_translation, "da", "models.attributes.user.name", "Navn")
40
+ gs.__send__(:add_translation, "da", "activerecord.models.user.one", "Bruger")
41
+ gs.__send__(:add_translation, "da", "activerecord.models.user.other", "Brugere")
42
+ gs.__send__(:add_translation, "da", "activerecord.attributes.user.name", "Navn")
44
43
 
45
44
  injector = GettextSimpleRails::I18nInjector.new
46
- injector.inject_model_translations(gs)
45
+ injector.inject_translator_translations(gs)
47
46
 
48
47
  I18n.with_locale :da do
49
48
  assert_equal "Bruger", I18n.t("activerecord.models.user.one")
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe GettextSimpleRails::Translators::GlobalizeTranslator do
4
+ before do
5
+ # Make it possible to call the Rake task.
6
+ ::Dummy::Application.load_tasks
7
+
8
+ # Clean up any existing translations.
9
+ FileUtils.rm_r(GettextSimpleRails.translation_dir) if File.exists?(GettextSimpleRails.translation_dir)
10
+
11
+ # Generate model translations so we can check them.
12
+ ::Rake::Task["gettext_simple_rails:generate_translator_files"].execute
13
+ end
14
+
15
+ it "should generate translations for validations" do
16
+ filepath = "#{GettextSimpleRails.translation_dir}/globalize_translator_translations.rb"
17
+ cont = File.read(filepath)
18
+ cont.should include "_('activerecord.attributes.user.title')"
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_simple_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: globalize
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 4.0.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 4.0.1
97
111
  description: Inspects models and other modules to easily generate .po-files and translate
98
112
  them with POEdit.
99
113
  email:
@@ -115,9 +129,11 @@ files:
115
129
  - lib/gettext_simple_rails/i18n_injector.rb
116
130
  - lib/gettext_simple_rails/version.rb
117
131
  - lib/gettext_simple_rails/model_inspector.rb
132
+ - lib/gettext_simple_rails/translators/active_record_validations_translator.rb
118
133
  - lib/gettext_simple_rails/translators/simple_form_translator.rb
134
+ - lib/gettext_simple_rails/translators/globalize_translator.rb
119
135
  - lib/gettext_simple_rails/translators/active_admin_translator.rb
120
- - lib/gettext_simple_rails/translators/active_record_translator.rb
136
+ - lib/gettext_simple_rails/translators/active_record_attributes_translator.rb
121
137
  - lib/gettext_simple_rails/translators/number_translator.rb
122
138
  - lib/gettext_simple_rails/translators/devise_translator.rb
123
139
  - lib/gettext_simple_rails/translators/date_translator.rb
@@ -126,6 +142,7 @@ files:
126
142
  - lib/tasks/gettext_simple_rails_tasks.rake
127
143
  - MIT-LICENSE
128
144
  - Rakefile
145
+ - spec/globalize_translator_spec.rb
129
146
  - spec/poedit_config_with_ruby.conf
130
147
  - spec/poedit_config_without_ruby.conf
131
148
  - spec/cache_handler_spec.rb
@@ -135,8 +152,11 @@ files:
135
152
  - spec/dummy/config.ru
136
153
  - spec/dummy/README.rdoc
137
154
  - spec/dummy/Rakefile
138
- - spec/dummy/lib/gettext_simple_rails/models/user_model_translations.rb
139
- - spec/dummy/lib/gettext_simple_rails/models/role_model_translations.rb
155
+ - spec/dummy/lib/gettext_simple_rails/date_translator_translations.rb
156
+ - spec/dummy/lib/gettext_simple_rails/active_record_validations_translator_translations.rb
157
+ - spec/dummy/lib/gettext_simple_rails/number_translator_translations.rb
158
+ - spec/dummy/lib/gettext_simple_rails/globalize_translator_translations.rb
159
+ - spec/dummy/lib/gettext_simple_rails/active_record_attributes_translator_translations.rb
140
160
  - spec/dummy/test/models/user_test.rb
141
161
  - spec/dummy/test/models/role_test.rb
142
162
  - spec/dummy/test/fixtures/users.yml
@@ -145,11 +165,10 @@ files:
145
165
  - spec/dummy/public/500.html
146
166
  - spec/dummy/public/422.html
147
167
  - spec/dummy/public/favicon.ico
148
- - spec/dummy/log/development.log
149
168
  - spec/dummy/log/test.log
150
169
  - spec/dummy/db/schema.rb
151
- - spec/dummy/db/development.sqlite3
152
170
  - spec/dummy/db/migrate/20140410170418_create_users.rb
171
+ - spec/dummy/db/migrate/20140515092420_create_user_translations.rb
153
172
  - spec/dummy/db/migrate/20140411112622_create_roles.rb
154
173
  - spec/dummy/db/test.sqlite3
155
174
  - spec/dummy/app/models/user.rb
@@ -184,8 +203,8 @@ files:
184
203
  - spec/setup_helper_spec.rb
185
204
  - spec/gettext_simple_rails_spec.rb
186
205
  - spec/spec_helper.rb
206
+ - spec/active_record_validations_spec.rb
187
207
  - spec/date_translator_spec.rb
188
- - spec/active_record_spec.rb
189
208
  homepage: http://www.github.com/kaspernj/gettext_simple_rails
190
209
  licenses:
191
210
  - MIT
@@ -211,6 +230,7 @@ signing_key:
211
230
  specification_version: 4
212
231
  summary: Helpers for translating a Rails app with Gettext and POEdit.
213
232
  test_files:
233
+ - spec/globalize_translator_spec.rb
214
234
  - spec/poedit_config_with_ruby.conf
215
235
  - spec/poedit_config_without_ruby.conf
216
236
  - spec/cache_handler_spec.rb
@@ -220,8 +240,11 @@ test_files:
220
240
  - spec/dummy/config.ru
221
241
  - spec/dummy/README.rdoc
222
242
  - spec/dummy/Rakefile
223
- - spec/dummy/lib/gettext_simple_rails/models/user_model_translations.rb
224
- - spec/dummy/lib/gettext_simple_rails/models/role_model_translations.rb
243
+ - spec/dummy/lib/gettext_simple_rails/date_translator_translations.rb
244
+ - spec/dummy/lib/gettext_simple_rails/active_record_validations_translator_translations.rb
245
+ - spec/dummy/lib/gettext_simple_rails/number_translator_translations.rb
246
+ - spec/dummy/lib/gettext_simple_rails/globalize_translator_translations.rb
247
+ - spec/dummy/lib/gettext_simple_rails/active_record_attributes_translator_translations.rb
225
248
  - spec/dummy/test/models/user_test.rb
226
249
  - spec/dummy/test/models/role_test.rb
227
250
  - spec/dummy/test/fixtures/users.yml
@@ -230,11 +253,10 @@ test_files:
230
253
  - spec/dummy/public/500.html
231
254
  - spec/dummy/public/422.html
232
255
  - spec/dummy/public/favicon.ico
233
- - spec/dummy/log/development.log
234
256
  - spec/dummy/log/test.log
235
257
  - spec/dummy/db/schema.rb
236
- - spec/dummy/db/development.sqlite3
237
258
  - spec/dummy/db/migrate/20140410170418_create_users.rb
259
+ - spec/dummy/db/migrate/20140515092420_create_user_translations.rb
238
260
  - spec/dummy/db/migrate/20140411112622_create_roles.rb
239
261
  - spec/dummy/db/test.sqlite3
240
262
  - spec/dummy/app/models/user.rb
@@ -269,5 +291,5 @@ test_files:
269
291
  - spec/setup_helper_spec.rb
270
292
  - spec/gettext_simple_rails_spec.rb
271
293
  - spec/spec_helper.rb
294
+ - spec/active_record_validations_spec.rb
272
295
  - spec/date_translator_spec.rb
273
- - spec/active_record_spec.rb
Binary file