fast_gettext 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9d5f307b5c77058b4e90205bec338515039454ece351af86c9b6ce51f5188af
4
- data.tar.gz: d7ca414f86fd49d9ab842c6741ec69813c278b509b872730e399f61e37a87578
3
+ metadata.gz: 20e208d22e9a3e7d486f620c2c134e4e602c4d31411d737a07a4fc700a5cb50d
4
+ data.tar.gz: '09d8b2bc909e0163e1120dc61d9e87dc23604dce84829f20ddf4fe19c8433ff1'
5
5
  SHA512:
6
- metadata.gz: bd9cc4efaab08b0818b423926d90f7130877884f743c9d402e580ee2491b3896b67e8377936ac38c02e283d4c7781862d9376c7a3e2865641080379ab3831dde
7
- data.tar.gz: 7bd0d59d6ad714ff8379048516ec7f13067da04cda86d2a7de40fc3fc88eb49444a80373ee95bf65f6161b47393d1dc54de9e0db40ad7b10a027b1c51ecb99c1
6
+ metadata.gz: 9746937a00829ef51350812f51207941014bb7f354417e585c7f2f5b19415ea83abd762e7d6cf679ec56c595b509b36a523decc187fec5c185819bfb003f54cd
7
+ data.tar.gz: 4779c2456eaab59d6012eb6a00009cbf5869c5db46fab4cf52d1717062141e10b9b4341d4ffc524d63403f85d6fc79af9019482b15ab3866115a2ce06ccd3b68
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 4.0.0 -- Remove String#% hack that would make it not blow up when using invalid keys, can temporarily restore with `FastGettext.allow_invalid_keys!`
2
+ 3.1.0 -- Work with frozen strings
1
3
  3.0.0 -- Drop ruby 2.x support
2
4
  2.4.0 -- Depend on prime gem
3
5
  2.3.0 -- Load empty mo file only once
@@ -47,8 +47,8 @@ module FastGettext
47
47
  :trans_sysdep_tab_offset
48
48
  end
49
49
 
50
- MAGIC_BIG_ENDIAN = "\x95\x04\x12\xde"
51
- MAGIC_LITTLE_ENDIAN = "\xde\x12\x04\x95"
50
+ MAGIC_BIG_ENDIAN = +"\x95\x04\x12\xde"
51
+ MAGIC_LITTLE_ENDIAN = +"\xde\x12\x04\x95"
52
52
  if "".respond_to?(:force_encoding)
53
53
  MAGIC_BIG_ENDIAN.force_encoding("ASCII-8BIT")
54
54
  MAGIC_LITTLE_ENDIAN.force_encoding("ASCII-8BIT")
@@ -58,19 +58,3 @@ rescue ArgumentError
58
58
  end
59
59
  end
60
60
  end
61
-
62
- # 1.9.1 if you misspell a %{key} your whole page would blow up, no thanks...
63
- begin
64
- ("%{b}" % {:a=>'b'})
65
- rescue KeyError
66
- class String
67
- alias :_fast_gettext_old_format_m :%
68
- def %(*args)
69
- begin
70
- _fast_gettext_old_format_m(*args)
71
- rescue KeyError
72
- self
73
- end
74
- end
75
- end
76
- end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastGettext
4
- VERSION = Version = '3.0.0' # rubocop:disable Naming/ConstantName
4
+ VERSION = Version = '4.0.0' # rubocop:disable Naming/ConstantName
5
5
  end
data/lib/fast_gettext.rb CHANGED
@@ -28,6 +28,22 @@ module FastGettext
28
28
  translation_repositories[name] = TranslationRepository.build(name, options)
29
29
  end
30
30
 
31
+ # deprecated, just a crutch to migrate to new api
32
+ def self.allow_invalid_keys!
33
+ eval(<<~CODE)
34
+ class ::String
35
+ alias :_fast_gettext_old_format_m :%
36
+ def %(*args)
37
+ begin
38
+ _fast_gettext_old_format_m(*args)
39
+ rescue KeyError
40
+ self
41
+ end
42
+ end
43
+ end
44
+ CODE
45
+ end
46
+
31
47
  # some repositories know where to store their locales
32
48
  def self.locale_path
33
49
  translation_repositories[text_domain].instance_variable_get(:@options)[:path]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_gettext
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2025-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prime