fast_gettext 0.5.9 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -52,7 +52,8 @@ From mo files (traditional/default)
52
52
 
53
53
  Or po files (less maintenance than mo)
54
54
  FastGettext.add_text_domain('my_app',:path=>'locale', :type=>:po)
55
- # :ignore_fuzzy => true to silence warnings
55
+ # :ignore_fuzzy => true to silence warnings about fuzzy translations
56
+ # :ignore_obsolete => true to silence warnings about obsolete translations
56
57
 
57
58
  Or yaml files (use I18n syntax/indentation)
58
59
  FastGettext.add_text_domain('my_app',:path=>'config/locales', :type=>:yaml)
@@ -191,6 +192,7 @@ Mo/Po-file parsing from Masao Mutoh, see vendor/README
191
192
  - [geekq](http://www.innoq.com/blog/vd)
192
193
  - [Matt Sanford](http://blog.mzsanford.com)
193
194
  - [Antonio Terceiro](http://softwarelivre.org/terceiro)
195
+ - [J. Pablo Fernández](http://pupeno.com)
194
196
  - Rudolf Gavlas
195
197
 
196
198
  [Michael Grosser](http://pragmatig.wordpress.com)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.9
1
+ 0.5.10
data/fast_gettext.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fast_gettext}
8
- s.version = "0.5.9"
8
+ s.version = "0.5.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2010-09-16}
12
+ s.date = %q{2010-09-17}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
@@ -82,6 +82,7 @@ Gem::Specification.new do |s|
82
82
  "spec/locale/yaml/de.yml",
83
83
  "spec/locale/yaml/en.yml",
84
84
  "spec/locale/yaml/notfound.yml",
85
+ "spec/obsolete_locale/de/test.po",
85
86
  "spec/spec_helper.rb"
86
87
  ]
87
88
  s.homepage = %q{http://github.com/grosser/fast_gettext}
@@ -7,7 +7,7 @@ module FastGettext
7
7
  def self.to_mo_file(file, options={})
8
8
  require 'fast_gettext/vendor/poparser'
9
9
  mo_file = FastGettext::GetText::MOFile.new
10
- FastGettext::GetText::PoParser.new.parse(File.read(file), mo_file, !options[:ignore_fuzzy])
10
+ FastGettext::GetText::PoParser.new.parse(File.read(file), mo_file, !options[:ignore_fuzzy], !options[:ignore_obsolete])
11
11
  MoFile.new(mo_file)
12
12
  end
13
13
  end
@@ -30,7 +30,7 @@ module_eval <<'..end src/poparser.ry modeval..id7a99570e05', 'src/poparser.ry',
30
30
  ret
31
31
  end
32
32
 
33
- def parse(str, data, ignore_fuzzy = true)
33
+ def parse(str, data, ignore_fuzzy = true, show_obsolete = true)
34
34
  @comments = []
35
35
  @data = data
36
36
  @fuzzy = false
@@ -59,8 +59,10 @@ module_eval <<'..end src/poparser.ry modeval..id7a99570e05', 'src/poparser.ry',
59
59
  @q.push [:PLURAL_NUM, $1]
60
60
  str = $'
61
61
  when /\A\#~(.*)/
62
- $stderr.print _("Warning: obsolete msgid exists.\n")
63
- $stderr.print " #{$&}\n"
62
+ if show_obsolete
63
+ $stderr.print _("Warning: obsolete msgid exists.\n")
64
+ $stderr.print " #{$&}\n"
65
+ end
64
66
  @q.push [:COMMENT, $&]
65
67
  str = $'
66
68
  when /\A\#(.*)/
@@ -38,4 +38,16 @@ describe 'FastGettext::TranslationRepository::Po' do
38
38
  FastGettext::TranslationRepository.build('test',:path=>File.join('spec','fuzzy_locale'),:type=>:po, :ignore_fuzzy => true)
39
39
  end
40
40
  end
41
+
42
+ describe 'obsolete' do
43
+ it "should warn on obsolete by default" do
44
+ $stderr.should_receive(:print).at_least(:once)
45
+ FastGettext::TranslationRepository.build('test',:path=>File.join('spec','obsolete_locale'),:type=>:po)
46
+ end
47
+
48
+ it "should ignore obsolete when told to do so" do
49
+ $stderr.should_not_receive(:print)
50
+ FastGettext::TranslationRepository.build('test',:path=>File.join('spec','obsolete_locale'),:type=>:po, :ignore_obsolete => true)
51
+ end
52
+ end
41
53
  end
@@ -0,0 +1,21 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: version 0.0.1\n"
10
+ "POT-Creation-Date: 2009-02-26 19:50+0100\n"
11
+ "PO-Revision-Date: 2009-02-18 14:53+0100\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18
+
19
+ #: app/helpers/translation_helper.rb:3
20
+ #~ msgid "%{relative_time} ago"
21
+ #~ msgstr "vor %{relative_time}"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 9
9
- version: 0.5.9
8
+ - 10
9
+ version: 0.5.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-16 00:00:00 +02:00
17
+ date: 2010-09-17 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -94,6 +94,7 @@ files:
94
94
  - spec/locale/yaml/de.yml
95
95
  - spec/locale/yaml/en.yml
96
96
  - spec/locale/yaml/notfound.yml
97
+ - spec/obsolete_locale/de/test.po
97
98
  - spec/spec_helper.rb
98
99
  has_rdoc: true
99
100
  homepage: http://github.com/grosser/fast_gettext