packnga 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  Packnga::DocumentTask.new(spec) do |task|
48
48
  task.original_language = "en"
49
- task.translate_languages = "ja"
49
+ task.translate_language = "ja"
50
50
  end
51
51
 
52
52
  Packnga::ReleaseTask.new(spec) do |task|
@@ -1,5 +1,25 @@
1
1
  h1. NEWS
2
2
 
3
+ h2. 0.9.7: 2012-12-26
4
+
5
+ h3. Improvements
6
+
7
+ * [DocumentTask] Added DocumentTask#translate_language= to specifiy
8
+ single language code for translation of documents.
9
+ * [DocumentTask] Updated documents about #translate_languages= and
10
+ #original_language=.
11
+ * [ReferenceTask] Updated documents about #translate_languages and
12
+ #original_language.
13
+
14
+ h3. Changes
15
+
16
+ * [DocumentTask] Received only Array of languages codes by
17
+ #translate_languages=.
18
+
19
+ h3. Fixes
20
+
21
+ * For ranguba project: removed remained piwik tag in the footer template.
22
+
3
23
  h2. 0.9.6: 2012-12-19
4
24
 
5
25
  h3. Improvements
@@ -48,16 +48,62 @@ module Packnga
48
48
  end
49
49
 
50
50
  # Sets original language which you wrote document.
51
- # Default value is your current locale (Locale.current.to_s).
51
+ # Default value is "en" (as English).
52
+ # Specified value is used to define language for translation.
53
+ #
54
+ # @see DocumentTask#translate_languages= #translate_language(s)= is used to specify languages for translation.
52
55
  # @param [String] language language you wrote document
56
+ #
57
+ # @since 0.9.6
53
58
  def original_language=(language)
54
59
  @reference_task.original_language = language
55
60
  end
56
61
 
62
+ # Sets a translate language for document.
63
+ # This method receives String as language code.
64
+ #
65
+ # @see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
66
+ # see "639-1" row in this page for lanugage codes.
67
+ #
68
+ # @example Specify Japanese.
69
+ # DocumentTask.new(spec) do |task|
70
+ # task.translate_language = "ja"
71
+ # end
72
+ #
73
+ # @!macro [new] document-task.translate_lanuguage.default_value
74
+ # If the language specified by {#original_language=} isn't
75
+ # English, its default value is one.
76
+ # Otherwise, it is not specified.
77
+ #
78
+ # @see DocumentTask#translate_languages=
79
+ # #translate_languages= receives Array of String target languages codes.
80
+ # @param [String] language target language code for translated document
81
+ #
82
+ # @since 0.9.7
83
+ def translate_language=(language)
84
+ self.translate_languages = [language]
85
+ end
86
+
57
87
  # Sets translate languages for document.
58
- # @param [String] languages languages to translate
88
+ # This method receives Array of Strings as each language code.
89
+ #
90
+ # @see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
91
+ # see "639-1" row in this page for lanugage codes.
92
+ #
93
+ # @example Sets Japanese and English.
94
+ # DocumentTask.new(spec) do |task|
95
+ # task.translate_languages = ["ja", "en"]
96
+ # end
97
+ #
98
+ # @!macro document-task.translate_lanuguage.default_value
99
+ #
100
+ # @see DocumentTask#translate_language=
101
+ # #translate_language= receives String as target language code.
102
+ # @param [Array<String>] languages
103
+ # target language codes for translated document
104
+ #
105
+ # @since 0.9.6
59
106
  def translate_languages=(languages)
60
- languages = [languages] if languages.instance_of?(String)
61
107
  @reference_task.translate_languages = languages
62
108
  end
63
109
 
@@ -48,14 +48,25 @@ module Packnga
48
48
  attr_accessor :text_files
49
49
 
50
50
  # This attribute is used to set the language you wrote original
51
- # document. Its default value is your current locale.
51
+ # document. Its default value is "en" (English).
52
52
  # @return [String] language you used to write document
53
+ #
54
+ # @see DocumentTask#original_language=
55
+ #
56
+ # @since 0.9.6
53
57
  attr_accessor :original_language
54
58
 
55
- # This attribute is used to set languages for tnanslated document.
56
- # If original_language isn't one, its default value is English.
59
+ # This attribute is used to set languages for translated document.
60
+ # If original_language isn't English, its default value is one.
57
61
  # Otherwise, it is not specified.
62
+ #
63
+ # @see DocumentTask#translate_languages=
64
+ # See this page to specifiy multiple languages to this attribute.
65
+ # @see DocumentTask#translate_language=
66
+ # See this page to specifiy a single language to this attribute.
58
67
  # @return [Array<String>] target languages
68
+ #
69
+ # @since 0.9.6
59
70
  attr_accessor :translate_languages
60
71
 
61
72
  # @private
@@ -88,7 +99,7 @@ module Packnga
88
99
  private
89
100
  def set_default_values
90
101
  @base_dir ||= Pathname.new("doc")
91
- @original_language ||= current_language
102
+ @original_language ||= "en"
92
103
  if @original_language == "en"
93
104
  @translate_languages ||= []
94
105
  else
@@ -102,18 +113,6 @@ module Packnga
102
113
  @files = @source_files + @extra_files
103
114
  end
104
115
 
105
- def current_language
106
- locale = Locale.current
107
- language = locale.language
108
- region = locale.region
109
-
110
- if region.nil?
111
- language
112
- else
113
- "#{language}_#{region}"
114
- end
115
- end
116
-
117
116
  def reference_base_dir
118
117
  @base_dir + "reference"
119
118
  end
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Packnga
20
20
  # Packnga version.
21
- VERSION = "0.9.6"
21
+ VERSION = "0.9.7"
22
22
  end
@@ -39,7 +39,7 @@ class DocumentTaskTest < Test::Unit::TestCase
39
39
  class TranslateLanguagesTest < self
40
40
  def test_single
41
41
  translate_language = "ja"
42
- options = {:translate_languages => translate_language}
42
+ options = {:translate_language => translate_language}
43
43
  document_task = create_document_task(options)
44
44
 
45
45
  document_task.reference do |reference_task|
@@ -60,9 +60,15 @@ class DocumentTaskTest < Test::Unit::TestCase
60
60
  private
61
61
  def create_document_task(options)
62
62
  translate_languages = options[:translate_languages]
63
+ translate_language = options[:translate_language]
64
+
63
65
  spec = Gem::Specification.new
64
66
  Packnga::DocumentTask.new(spec) do |task|
65
- task.translate_languages = translate_languages
67
+ if translate_languages.nil?
68
+ task.translate_language = translate_language
69
+ else
70
+ task.translate_languages = translate_languages
71
+ end
66
72
  end
67
73
  end
68
74
  end
@@ -33,7 +33,7 @@ class ReferenceTaskTest < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  Packnga::DocumentTask.new(spec) do |task|
36
- task.translate_languages = language
36
+ task.translate_language = language
37
37
  task.base_dir = base_dir
38
38
  end
39
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packnga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-19 00:00:00.000000000 Z
13
+ date: 2012-12-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -182,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  segments:
184
184
  - 0
185
- hash: 4177022307643837781
185
+ hash: -416471251229729484
186
186
  required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  none: false
188
188
  requirements:
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  segments:
193
193
  - 0
194
- hash: 4177022307643837781
194
+ hash: -416471251229729484
195
195
  requirements: []
196
196
  rubyforge_project:
197
197
  rubygems_version: 1.8.23