phrase 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/phrase.rb CHANGED
@@ -12,7 +12,7 @@ module Phrase
12
12
  Thread.current[:phrase_config] = value
13
13
  end
14
14
 
15
- %w(backend default_locale available_locales).each do |method|
15
+ %w(backend default_locale available_locales prefix suffix).each do |method|
16
16
  module_eval <<-DELEGATORS, __FILE__, __LINE__ + 1
17
17
  def #{method}
18
18
  config.#{method}
@@ -2,9 +2,6 @@
2
2
 
3
3
  module Phrase::Backend::Base
4
4
 
5
- PREFIX = "{{__phrase_"
6
- SUFFIX = "__}}"
7
-
8
5
  def translate(*args)
9
6
  key = lookup_normalized_key(*args)
10
7
  case key[:translation]
@@ -16,7 +13,7 @@ module Phrase::Backend::Base
16
13
  protected
17
14
  def decorate_translation(key=nil)
18
15
  return nil unless key.presence
19
- "#{PREFIX}#{key}#{SUFFIX}"
16
+ "#{Phrase.prefix}phrase_#{key}#{Phrase.suffix}"
20
17
  end
21
18
 
22
19
  def translation_presence(*args)
data/lib/phrase/config.rb CHANGED
@@ -31,5 +31,21 @@ module Phrase
31
31
  @@available_locales = Array(locales).map { |locale| locale.to_sym }
32
32
  @@available_locales = nil if @@available_locales.empty?
33
33
  end
34
+
35
+ def prefix
36
+ @@prefix ||= "{{__"
37
+ end
38
+
39
+ def prefix=(prefix)
40
+ @@prefix = prefix
41
+ end
42
+
43
+ def suffix
44
+ @@suffix ||= "__}}"
45
+ end
46
+
47
+ def suffix=(suffix)
48
+ @@suffix = suffix
49
+ end
34
50
  end
35
51
  end
data/phrase.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "phrase"
7
- s.version = "0.0.6"
7
+ s.version = "0.0.7"
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Dynport GmbH"]
10
10
  s.email = ["info@phraseapp.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phrase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-29 00:00:00.000000000Z
12
+ date: 2012-04-13 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: phrase allows you to edit translations inline, on the page itself. More
15
15
  information at phraseapp.com