bisu 1.10.1 → 1.10.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: 41fa600d8b33846f4a860595f47093d7105a79f7690968c4b3d0428fec0936ea
4
- data.tar.gz: 2f4fed77d3e7b4688c8c0dd77dff43f96c32f0e52f2ebde3343115c0f25249cb
3
+ metadata.gz: fd090e1e936ebc979392e5ba1cb44657bf0c716fdadbc1566f3aafa8252ff3dd
4
+ data.tar.gz: 89b8897c02e0ef9eba1945c125b43e4dff1fc38db73017d2eeca8b3ebb16674c
5
5
  SHA512:
6
- metadata.gz: f3ea51eff598f91be9dfdcc43fc14e858e56839c956949d38777bbf551fea15021caa25264d4f9c70ca7e8086c8beb976cd9249a8efdf2fba4c2d1572558ba34
7
- data.tar.gz: f27e7c904060eb9ae83807b8c4028db4e7cfbfecd963bb3ff5d4af30d417ce8a820b9ff99eceb58d972916b0ee948f81e1a31e9f001739c3e06108ca3aa9f4c9
6
+ metadata.gz: 521148f8d23cb2bc308eab074f90c2b964cee468a3fa65594504153d834b4878fd4b1dc9fcc96c7a04064e909b534bc6cafec49b199164d3b5d8310f215f8e36
7
+ data.tar.gz: a011abe84e8c72ef2ad755f64595141f03acbd7367b70c321fb867f059f3891debd4878545acfaa8bb7f59b5ea1562aae3683430d7613d05244249af6ce67315
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  `Bisu` adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [1.10.2](https://github.com/hole19/bisu/releases/tag/v1.10.2)
6
+ Released on 2021/08/30
7
+
8
+ #### Fixed
9
+ - Fixes bug where we were assuming "key" would always be the translations-key column title
10
+
11
+ ## [1.10.1](https://github.com/hole19/bisu/releases/tag/v1.10.1)
12
+ Released on 2021/08/30
13
+
14
+ #### Fixed
15
+ - Crash caused by an unexpected redirect
16
+
5
17
  ## [1.10.0](https://github.com/hole19/bisu/releases/tag/v1.10.0)
6
18
  Released on 2021/08/30
7
19
 
data/README.md CHANGED
@@ -74,6 +74,7 @@ Setup your configuration file
74
74
  dictionary:
75
75
  type: google_sheet
76
76
  url: <GOOGLE-DRIVE-SHEET-CSV-URL>
77
+ keys_column: <GOOGLE-DRIVE-KEY-COLUMN-TITLE>
77
78
  ```
78
79
 
79
80
  ##### OneSky integration:
@@ -4,6 +4,7 @@ type: iOS
4
4
  dictionary:
5
5
  type: google_sheet
6
6
  url: <GOOGLE-DRIVE-SHEET-CSV-URL>
7
+ keys_column: <GOOGLE-DRIVE-KEY-COLUMN-TITLE>
7
8
 
8
9
  translate:
9
10
  - in: path/to/1st/file.translatable
data/lib/bisu/config.rb CHANGED
@@ -62,6 +62,7 @@ module Bisu
62
62
  elements: {
63
63
  type: { type: String },
64
64
  url: { type: String },
65
+ keys_column: { type: String },
65
66
  },
66
67
  }
67
68
 
@@ -4,8 +4,9 @@ require "csv"
4
4
  module Bisu
5
5
  module Source
6
6
  class GoogleSheet
7
- def initialize(url)
7
+ def initialize(url, keys_column)
8
8
  @url = url
9
+ @keys_column = keys_column
9
10
  end
10
11
 
11
12
  def to_i18
@@ -20,7 +21,7 @@ module Bisu
20
21
 
21
22
  csv.each do |row|
22
23
  languages.each do |lang|
23
- hash[lang][row["key"]] = row[lang] unless row[lang].nil?
24
+ hash[lang][row[@keys_column]] = row[lang] unless row[lang].nil?
24
25
  end
25
26
  end
26
27
 
data/lib/bisu/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bisu
2
- VERSION = '1.10.1'
2
+ VERSION = '1.10.2'
3
3
  VERSION_UPDATED_AT = '2021-08-30'
4
4
  end
data/lib/bisu.rb CHANGED
@@ -59,7 +59,7 @@ module Bisu
59
59
  source =
60
60
  case config[:type]
61
61
  when "google_sheet"
62
- Bisu::Source::GoogleSheet.new(config[:url])
62
+ Bisu::Source::GoogleSheet.new(config[:url], config[:keys_column])
63
63
  when "one_sky"
64
64
  Bisu::Source::OneSky.new(config[:api_key], config[:api_secret], config[:project_id], config[:file_name])
65
65
  when "url"
@@ -70,7 +70,7 @@ module Bisu
70
70
 
71
71
  save_to_path = options[:dictionary_save_path]
72
72
  if save_to_path && file = open_file(save_to_path, "w", false)
73
- file.write(source.to_json)
73
+ file.write(deep_force_encoding(source).to_json)
74
74
  file.flush
75
75
  file.close
76
76
  end
@@ -149,4 +149,15 @@ module Bisu
149
149
 
150
150
  true
151
151
  end
152
+
153
+ def deep_force_encoding(hash)
154
+ hash.each do |_, value|
155
+ case value
156
+ when String
157
+ value.force_encoding(Encoding::UTF_8)
158
+ when Hash
159
+ deep_force_encoding(value)
160
+ end
161
+ end
162
+ end
152
163
  end
@@ -3,6 +3,7 @@ type: iOS
3
3
  dictionary:
4
4
  type: google_sheet
5
5
  url: sheet-public-url
6
+ keys_column: "key name"
6
7
 
7
8
  translate:
8
9
  - in: hole19/Localizable.strings.translatable
@@ -1,4 +1,4 @@
1
- key,en,ja,fr,de,ko
1
+ key name,en,ja,fr,de,ko
2
2
  kConnectFacebook,Connect with Facebook,フェイスブックへ接続,Connexion par Facebook,Mit Facebook verbinden,페이스북으로 접속
3
3
  kNoNoNoMr,"No, no, no. Mr %{name} not here",,,,
4
4
  kTwitterServer,,,,,트위터 서버연결 실패. \n잠시 후 재시도.
@@ -6,6 +6,7 @@ describe Bisu::Config do
6
6
  dictionary: {
7
7
  type: "google_sheet",
8
8
  url: "https://abc1234567890",
9
+ keys_column: "key name",
9
10
  },
10
11
  translate: [
11
12
  { in: "path/to/file/to/1.ext.translatable",
@@ -36,7 +37,7 @@ describe Bisu::Config do
36
37
  describe "#dictionary" do
37
38
  subject(:dictionary) { config.dictionary }
38
39
 
39
- it { should eq({ type: "google_sheet", url: "https://abc1234567890" }) }
40
+ it { should eq({ type: "google_sheet", url: "https://abc1234567890", keys_column: "key name" }) }
40
41
 
41
42
  context "when given a OneSky type dictionary" do
42
43
  before do
@@ -1,5 +1,5 @@
1
1
  describe Bisu::Source::GoogleSheet do
2
- subject(:to_i18) { Bisu::Source::GoogleSheet.new(url).to_i18 }
2
+ subject(:to_i18) { Bisu::Source::GoogleSheet.new(url, "key name").to_i18 }
3
3
 
4
4
  let(:url) { "https://docs.google.com/spreadsheets/d/e/2PACX-1vTm6yu_zfbxKizC-PvUE1HVFCsplmiyz0s0qLSIGeokA7KtS3BgtqaA79CsfYfPsXH6xzUaP8HDTcj8/pub?gid=0&single=true&output=csv" }
5
5
  let(:response) { File.read("spec/fixtures/sample_google_response.csv") }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bisu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - joaoffcosta