twine 1.1 → 1.1.2

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: d8667f50ad7147b8b7edac0d82ce542c2ecc973604c8334e878513b6acaa9a14
4
- data.tar.gz: 1ceb2b2b18dea8a3585bd91a1b427b30ebd9c888817dcf7140b3d211cd9e157c
3
+ metadata.gz: 381bd0d84850220b7ef1f8071a7398eb6c61e1f7c5bc057e5d96cd259f0f4578
4
+ data.tar.gz: 04a94d58790f88c95cf3ae000986f7f0df62165e2749cdc22e409fef391e2760
5
5
  SHA512:
6
- metadata.gz: a961953ec7b74510c10e17114b84c227bac43117a869ba4254d7410a16ea9413e4133a2c9f099c3d67922fd6e1632d841f366e79d28687e61f73861721dea43a
7
- data.tar.gz: 954b69b0d6e0fadec38cf145e0e1772eb1fde0259337b45ffac172d41b6f6c031b33373c768cfbb48ad3e9cfb1565dc9e91db8e825023421fdc30098439a4d86
6
+ metadata.gz: f14b9de69dcd4a533fa5b769dc42a2601caec06d41e04470188fa3a59a3e418d53e2d2994bce2c119fec6fee8252a7d7e421b58cd90316e98a527422c6a19551
7
+ data.tar.gz: 60bc8c8c800d1f4b3e3b1664504052bf4dc561fe97f1e62b361943de6567e5a5d22902c98f485e03f1e651f76765a7951142c915576ee80dfc6ae933df12139c
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Twine
2
2
 
3
- [![Continuous Integration by CircleCI](https://circleci.com/gh/scelis/twine.svg?style=shield)](https://circleci.com/gh/scelis/twine)
4
-
5
- Twine is a command line tool for managing your strings and their translations. These are all stored in a master text file and then Twine uses this file to import and export localization files in a variety of types, including iOS and Mac OS X `.strings` files, Android `.xml` files, gettext `.po` files, and [jquery-localize][jquerylocalize] `.json` files. This allows individuals and companies to easily share translations across multiple projects, as well as export localization files in any format the user wants.
3
+ Twine is a command line tool for managing your strings and their translations. These are all stored in a single text file and then Twine uses this file to import and export localization files in a variety of types, including iOS and Mac OS X `.strings` files, Android `.xml` files, gettext `.po` files, and [jquery-localize][jquerylocalize] `.json` files. This allows individuals and companies to easily share translations across multiple projects, as well as export localization files in any format the user wants.
6
4
 
7
5
  ## Install
8
6
 
@@ -24,7 +22,7 @@ Twine supports [`printf` style placeholders][printf] with one peculiarity: `@` i
24
22
 
25
23
  Tags are used by Twine as a way to only work with a subset of your definitions at any given point in time. Each definition can be assigned zero or more tags which are separated by commas. Tags are optional, though highly recommended. You can get a list of all definitions currently missing tags by executing the [`validate-twine-file`](#validate-twine-file) command with the `--pedantic` option.
26
24
 
27
- When generating a localization file, you can specify which definitions should be included using the `--tags` option. Provide a comma separated list of tags to match all definitions that contain any of the tags (`--tags tag1,tag2` matches all definitions tagged with `tag1` _or_ `tag2`). Provide multiple `--tags` options to match defintions containing all specified tags (`--tags tag1 --tags tag2` matches all definitions tagged with `tag1` _and_ `tag2`). You can match definitions _not_ containing a tag by prefixing the tag with a tilde (`--tags ~tag1` matches all definitions _not_ tagged with `tag1`). All three options are combinable.
25
+ When generating a localization file, you can specify which definitions should be included using the `--tags` option. Provide a comma separated list of tags to match all definitions that contain any of the tags (`--tags tag1,tag2` matches all definitions tagged with `tag1` _or_ `tag2`). Provide multiple `--tags` options to match definitions containing all specified tags (`--tags tag1 --tags tag2` matches all definitions tagged with `tag1` _and_ `tag2`). You can match definitions _not_ containing a tag by prefixing the tag with a tilde (`--tags ~tag1` matches all definitions _not_ tagged with `tag1`). All three options are combinable.
28
26
 
29
27
  ### Whitespace
30
28
 
@@ -81,7 +79,7 @@ Twine currently supports the following output formats:
81
79
  * HTML tags will be escaped by replacing `<` with `&lt`
82
80
  * Tags inside `<![CDATA[` won't be escaped.
83
81
  * Supports [basic styling][androidstyling] according to [Android documentation](https://developer.android.com/guide/topics/resources/string-resource.html#StylingWithHTML). All of the documented tags are supported, in addition to `<a>` links.
84
- * These tags will *not* be escaped if the string doesn't contain placeholders. You can reference them directly in your layouts or by using [`getText()`](https://developer.android.com/reference/android/content/res/Resources.html#getText(int)) to read them programatically.
82
+ * These tags will *not* be escaped if the string doesn't contain placeholders. You can reference them directly in your layouts or by using [`getText()`](https://developer.android.com/reference/android/content/res/Resources.html#getText(int)) to read them programmatically.
85
83
  * These tags *will* be escaped if the string contains placeholders. You can use [`getString()`](https://developer.android.com/reference/android/content/res/Resources.html#getString(int,%20java.lang.Object...)) combined with [`fromHtml`](https://developer.android.com/reference/android/text/Html.html#fromHtml(java.lang.String)) as shown in the [documentation][androidstyling] to display them.
86
84
  * See [\#212](https://github.com/scelis/twine/issues/212) for details.
87
85
  * [Gettext PO Files][gettextpo] (format: gettext)
@@ -203,7 +201,7 @@ buildscript {
203
201
  repositories { jcenter() }
204
202
 
205
203
  dependencies {
206
- /* NOTE: Set your prefered version of jruby here. */
204
+ /* NOTE: Set your preferred version of jruby here. */
207
205
  classpath "com.github.jruby-gradle:jruby-gradle-plugin:1.5.0"
208
206
  }
209
207
  }
@@ -211,8 +209,8 @@ buildscript {
211
209
  apply plugin: 'com.github.jruby-gradle.base'
212
210
 
213
211
  dependencies {
214
- /* NOTE: Set your prefered version of twine here. */
215
- jrubyExec 'rubygems:twine:1.0.3'
212
+ /* NOTE: Set your preferred version of twine here. */
213
+ jrubyExec 'rubygems:twine:1.1'
216
214
  }
217
215
 
218
216
  task generateLocalizations (type: JRubyExec) {
@@ -65,6 +65,7 @@ module Twine
65
65
  document.root.children.each do |child|
66
66
  if child.is_a? REXML::Comment
67
67
  content = child.string.strip
68
+ content.gsub!(/[\s]+/, ' ')
68
69
  comment = content if content.length > 0 and not content.start_with?("SECTION:")
69
70
  elsif child.is_a? REXML::Element
70
71
  next unless child.name == 'string'
@@ -13,6 +13,7 @@ module Twine
13
13
 
14
14
  def fallback_languages(language)
15
15
  fallback_mapping = {
16
+ 'zh-CN' => 'zh-Hans', # if we don't have a zh-CN translation, try zh-Hans before en
16
17
  'zh-TW' => 'zh-Hant' # if we don't have a zh-TW translation, try zh-Hant before en
17
18
  }
18
19
 
@@ -44,7 +44,7 @@ module Twine
44
44
  end
45
45
 
46
46
  def translation_for_lang(lang)
47
- translation = [lang].flatten.map { |l| @translations[l] }.first
47
+ translation = [lang].flatten.map { |l| @translations[l] }.compact.first
48
48
 
49
49
  translation = reference.translation_for_lang(lang) if translation.nil? && reference
50
50
 
data/lib/twine/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Twine
2
- VERSION = '1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -167,6 +167,24 @@ class TestAndroidFormatter < FormatterTest
167
167
  assert_equal 'This is\n a string', @empty_twine_file.definitions_by_key["foo"].translations['en']
168
168
  end
169
169
 
170
+ def test_read_multiline_comment
171
+ content = <<-EOCONTENT
172
+ <?xml version="1.0" encoding="utf-8"?>
173
+ <resources>
174
+ <!-- multiline
175
+ comment -->
176
+ <string name="foo">This is
177
+ a string</string>
178
+ </resources>
179
+ EOCONTENT
180
+
181
+ io = StringIO.new(content)
182
+
183
+ @formatter.read io, 'en'
184
+
185
+ assert_equal 'multiline comment', @empty_twine_file.definitions_by_key["foo"].comment
186
+ end
187
+
170
188
  def test_read_html_tags
171
189
  content = <<-EOCONTENT
172
190
  <?xml version="1.0" encoding="utf-8"?>
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twine
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-09 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rexml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rubyzip
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -170,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="
172
186
  - !ruby/object:Gem::Version
173
- version: '2.4'
187
+ version: '2.6'
174
188
  required_rubygems_version: !ruby/object:Gem::Requirement
175
189
  requirements:
176
190
  - - ">="