bisu 3.0.2 → 3.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/README.md +9 -0
- data/bisu.gemspec +16 -7
- data/lib/bisu/config.rb +9 -0
- data/lib/bisu/source/bisu.rb +41 -0
- data/lib/bisu/version.rb +1 -2
- data/lib/bisu.rb +3 -0
- metadata +22 -47
- data/.github/workflows/test.yml +0 -30
- data/.rspec +0 -4
- data/.travis.yml +0 -1
- data/Gemfile.lock +0 -60
- data/README_explanation.png +0 -0
- data/spec/fixtures/sample.translatable.yml +0 -19
- data/spec/fixtures/sample_google_response.csv +0 -4
- data/spec/fixtures/sample_json_response.json +0 -19
- data/spec/fixtures/sample_one_sky_response.json +0 -29
- data/spec/fixtures/sample_one_sky_response_with_bug.json +0 -8
- data/spec/fixtures/sample_tolgee_response.zip +0 -0
- data/spec/lib/bisu/config_spec.rb +0 -89
- data/spec/lib/bisu/dictionary_spec.rb +0 -76
- data/spec/lib/bisu/localizer_spec.rb +0 -212
- data/spec/lib/bisu/logger_spec.rb +0 -36
- data/spec/lib/bisu/object_extension_spec.rb +0 -100
- data/spec/lib/bisu/source/google_sheet_spec.rb +0 -43
- data/spec/lib/bisu/source/one_sky_spec.rb +0 -53
- data/spec/lib/bisu/source/tolgee_spec.rb +0 -45
- data/spec/lib/bisu/source/url_spec.rb +0 -33
- data/spec/lib/bisu_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -117
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6a3bdfb1c2dedb224a6fd6e2262f30a0de2f1730ecba4bc66b6a410c67fbe15
|
|
4
|
+
data.tar.gz: 2656c1cd5c9821677d042e2e7a2bae166d27bdb6f7a7d42bf066e5f3039876fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56770e1d056f6e098a27162c42d27abbed2c2fc3ae43a7d35f1af395ace7d23226311cd2f3a112187aa826e2ae383d13a6ff55b9bd2011c79fe95b96e7901351
|
|
7
|
+
data.tar.gz: 96438b25f69ec81dfa1b96a24fc2cdc5e085c72c4d956ec46921758e587706ade8d8909d626ed840605a7e0deb2ec6cb8c73fb42a2d989105688c8919e6d2dc1
|
data/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
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
|
-
##
|
|
5
|
+
## [3.1.0](https://github.com/hole19/bisu/releases/tag/v3.1.0)(2026-07-30)
|
|
6
|
+
|
|
7
|
+
- Add Bisu Platform as a translation source
|
|
6
8
|
|
|
7
9
|
## [3.0.2](https://github.com/hole19/bisu/releases/tag/v3.0.2)(2025-11-26)
|
|
8
10
|
|
data/README.md
CHANGED
|
@@ -79,6 +79,15 @@ Setup your configuration file
|
|
|
79
79
|
host: <TOLGEE-CUSTOM-HOST> (default: app.tolgee.io)
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
##### [Bisu Platform](https://github.com/hole19/bisu-platform)
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
dictionary:
|
|
86
|
+
type: bisu
|
|
87
|
+
api_key: <BISU-API-TOKEN> # bsu_...
|
|
88
|
+
host: <BISU-PLATFORM-HOST>
|
|
89
|
+
```
|
|
90
|
+
|
|
82
91
|
##### Google Sheets
|
|
83
92
|
|
|
84
93
|
1. First ["Publish to the web"](https://www.google.com/search?q=google+sheets+publish+to+web) your Google Sheet
|
data/bisu.gemspec
CHANGED
|
@@ -3,22 +3,31 @@ require_relative "lib/bisu/version"
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'bisu'
|
|
5
5
|
s.version = Bisu::VERSION
|
|
6
|
-
s.date = Bisu::VERSION_UPDATED_AT
|
|
7
6
|
s.summary = 'A localization automation service'
|
|
8
|
-
s.description =
|
|
7
|
+
s.description = "Bisu manages your app's iOS and Android localization files for you. No more copy+paste induced errors!"
|
|
9
8
|
s.authors = ['joaoffcosta']
|
|
10
9
|
s.email = 'joaostacosta@gmail.com'
|
|
11
10
|
s.license = 'MIT'
|
|
12
11
|
s.homepage = 'https://github.com/hole19/bisu'
|
|
13
12
|
|
|
14
|
-
s.
|
|
13
|
+
s.metadata = {
|
|
14
|
+
'source_code_uri' => 'https://github.com/hole19/bisu',
|
|
15
|
+
'changelog_uri' => 'https://github.com/hole19/bisu/blob/main/CHANGELOG.md',
|
|
16
|
+
'bug_tracker_uri' => 'https://github.com/hole19/bisu/issues',
|
|
17
|
+
'rubygems_mfa_required' => 'true',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
21
|
+
f.match(%r{\A(?:spec|\.github)/}) ||
|
|
22
|
+
f.match(%r{\A\.(?:travis\.yml|rspec)\z}) ||
|
|
23
|
+
%w[README_explanation.png Gemfile.lock].include?(f)
|
|
24
|
+
end
|
|
15
25
|
s.require_paths = ['lib']
|
|
16
26
|
s.executables = %w[ bisu ]
|
|
17
27
|
|
|
18
28
|
s.required_ruby_version = '>= 3.0.0'
|
|
19
29
|
|
|
20
|
-
s.add_dependency '
|
|
21
|
-
s.add_dependency '
|
|
22
|
-
s.
|
|
23
|
-
s.add_runtime_dependency 'rubyzip', '>= 2.0.0' # For extracting the Tolgee zip file
|
|
30
|
+
s.add_dependency 'colorize', '~> 1.1'
|
|
31
|
+
s.add_dependency 'csv', '>= 3.0' # For Google Sheets interpretation
|
|
32
|
+
s.add_dependency 'rubyzip', '>= 2.0.0', '< 4.0' # For extracting the Tolgee zip file
|
|
24
33
|
end
|
data/lib/bisu/config.rb
CHANGED
|
@@ -90,11 +90,20 @@ module Bisu
|
|
|
90
90
|
},
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
BISU_STRUCT = {
|
|
94
|
+
type: Hash,
|
|
95
|
+
elements: {
|
|
96
|
+
api_key: { type: String },
|
|
97
|
+
host: { type: String },
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
DICTIONARY_STRUCT = {
|
|
94
102
|
"google_sheet" => GOOGLE_SHEET_STRUCT,
|
|
95
103
|
"one_sky" => ONE_SKY_STRUCT,
|
|
96
104
|
"url" => URL_STRUCT,
|
|
97
105
|
"tolgee" => TOLGEE_STRUCT,
|
|
106
|
+
"bisu" => BISU_STRUCT,
|
|
98
107
|
}
|
|
99
108
|
end
|
|
100
109
|
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'net/https'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
module Bisu
|
|
5
|
+
module Source
|
|
6
|
+
class Bisu
|
|
7
|
+
def initialize(api_key, host)
|
|
8
|
+
@api_key = api_key
|
|
9
|
+
@host = host
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def to_i18
|
|
13
|
+
Logger.info("Downloading dictionary from Bisu Platform...")
|
|
14
|
+
|
|
15
|
+
hash = export
|
|
16
|
+
|
|
17
|
+
Logger.info("Found #{hash.count} languages.")
|
|
18
|
+
|
|
19
|
+
hash
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def export
|
|
25
|
+
uri = URI("https://#{@host}/api/v1/export?languages=all&mode=flat")
|
|
26
|
+
|
|
27
|
+
request = Net::HTTP::Get.new(uri)
|
|
28
|
+
request['Authorization'] = "Bearer #{@api_key}"
|
|
29
|
+
request['Accept'] = 'application/json'
|
|
30
|
+
|
|
31
|
+
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
|
|
32
|
+
http.request(request)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
raise "Bisu::Source::Bisu: Http Error #{response.body}" unless response.is_a?(Net::HTTPSuccess)
|
|
36
|
+
|
|
37
|
+
JSON.parse(response.body).fetch("data")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
data/lib/bisu/version.rb
CHANGED
data/lib/bisu.rb
CHANGED
|
@@ -9,6 +9,7 @@ require 'bisu/source/google_sheet'
|
|
|
9
9
|
require 'bisu/source/one_sky'
|
|
10
10
|
require 'bisu/source/url'
|
|
11
11
|
require 'bisu/source/tolgee'
|
|
12
|
+
require 'bisu/source/bisu'
|
|
12
13
|
require 'bisu/dictionary'
|
|
13
14
|
require 'bisu/localizer'
|
|
14
15
|
require 'bisu/version'
|
|
@@ -67,6 +68,8 @@ module Bisu
|
|
|
67
68
|
Bisu::Source::Url.new(config[:url])
|
|
68
69
|
when "tolgee"
|
|
69
70
|
Bisu::Source::Tolgee.new(config[:api_key], config[:host])
|
|
71
|
+
when "bisu"
|
|
72
|
+
Bisu::Source::Bisu.new(config[:api_key], config[:host])
|
|
70
73
|
end
|
|
71
74
|
|
|
72
75
|
source = source.to_i18
|
metadata
CHANGED
|
@@ -1,56 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bisu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- joaoffcosta
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: safe_yaml
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - ">="
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: 1.0.0
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - ">="
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: 1.0.0
|
|
26
12
|
- !ruby/object:Gem::Dependency
|
|
27
13
|
name: colorize
|
|
28
14
|
requirement: !ruby/object:Gem::Requirement
|
|
29
15
|
requirements:
|
|
30
|
-
- - "
|
|
16
|
+
- - "~>"
|
|
31
17
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
18
|
+
version: '1.1'
|
|
33
19
|
type: :runtime
|
|
34
20
|
prerelease: false
|
|
35
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
22
|
requirements:
|
|
37
|
-
- - "
|
|
23
|
+
- - "~>"
|
|
38
24
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
25
|
+
version: '1.1'
|
|
40
26
|
- !ruby/object:Gem::Dependency
|
|
41
27
|
name: csv
|
|
42
28
|
requirement: !ruby/object:Gem::Requirement
|
|
43
29
|
requirements:
|
|
44
30
|
- - ">="
|
|
45
31
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
32
|
+
version: '3.0'
|
|
47
33
|
type: :runtime
|
|
48
34
|
prerelease: false
|
|
49
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
36
|
requirements:
|
|
51
37
|
- - ">="
|
|
52
38
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
39
|
+
version: '3.0'
|
|
54
40
|
- !ruby/object:Gem::Dependency
|
|
55
41
|
name: rubyzip
|
|
56
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,6 +44,9 @@ dependencies:
|
|
|
58
44
|
- - ">="
|
|
59
45
|
- !ruby/object:Gem::Version
|
|
60
46
|
version: 2.0.0
|
|
47
|
+
- - "<"
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '4.0'
|
|
61
50
|
type: :runtime
|
|
62
51
|
prerelease: false
|
|
63
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -65,7 +54,10 @@ dependencies:
|
|
|
65
54
|
- - ">="
|
|
66
55
|
- !ruby/object:Gem::Version
|
|
67
56
|
version: 2.0.0
|
|
68
|
-
|
|
57
|
+
- - "<"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '4.0'
|
|
60
|
+
description: Bisu manages your app's iOS and Android localization files for you. No
|
|
69
61
|
more copy+paste induced errors!
|
|
70
62
|
email: joaostacosta@gmail.com
|
|
71
63
|
executables:
|
|
@@ -73,14 +65,9 @@ executables:
|
|
|
73
65
|
extensions: []
|
|
74
66
|
extra_rdoc_files: []
|
|
75
67
|
files:
|
|
76
|
-
- ".github/workflows/test.yml"
|
|
77
|
-
- ".rspec"
|
|
78
|
-
- ".travis.yml"
|
|
79
68
|
- CHANGELOG.md
|
|
80
69
|
- Gemfile
|
|
81
|
-
- Gemfile.lock
|
|
82
70
|
- README.md
|
|
83
|
-
- README_explanation.png
|
|
84
71
|
- Rakefile
|
|
85
72
|
- bin/bisu
|
|
86
73
|
- bisu.gemspec
|
|
@@ -91,32 +78,20 @@ files:
|
|
|
91
78
|
- lib/bisu/localizer.rb
|
|
92
79
|
- lib/bisu/logger.rb
|
|
93
80
|
- lib/bisu/object_extension.rb
|
|
81
|
+
- lib/bisu/source/bisu.rb
|
|
94
82
|
- lib/bisu/source/google_sheet.rb
|
|
95
83
|
- lib/bisu/source/one_sky.rb
|
|
96
84
|
- lib/bisu/source/tolgee.rb
|
|
97
85
|
- lib/bisu/source/url.rb
|
|
98
86
|
- lib/bisu/version.rb
|
|
99
|
-
- spec/fixtures/sample.translatable.yml
|
|
100
|
-
- spec/fixtures/sample_google_response.csv
|
|
101
|
-
- spec/fixtures/sample_json_response.json
|
|
102
|
-
- spec/fixtures/sample_one_sky_response.json
|
|
103
|
-
- spec/fixtures/sample_one_sky_response_with_bug.json
|
|
104
|
-
- spec/fixtures/sample_tolgee_response.zip
|
|
105
|
-
- spec/lib/bisu/config_spec.rb
|
|
106
|
-
- spec/lib/bisu/dictionary_spec.rb
|
|
107
|
-
- spec/lib/bisu/localizer_spec.rb
|
|
108
|
-
- spec/lib/bisu/logger_spec.rb
|
|
109
|
-
- spec/lib/bisu/object_extension_spec.rb
|
|
110
|
-
- spec/lib/bisu/source/google_sheet_spec.rb
|
|
111
|
-
- spec/lib/bisu/source/one_sky_spec.rb
|
|
112
|
-
- spec/lib/bisu/source/tolgee_spec.rb
|
|
113
|
-
- spec/lib/bisu/source/url_spec.rb
|
|
114
|
-
- spec/lib/bisu_spec.rb
|
|
115
|
-
- spec/spec_helper.rb
|
|
116
87
|
homepage: https://github.com/hole19/bisu
|
|
117
88
|
licenses:
|
|
118
89
|
- MIT
|
|
119
|
-
metadata:
|
|
90
|
+
metadata:
|
|
91
|
+
source_code_uri: https://github.com/hole19/bisu
|
|
92
|
+
changelog_uri: https://github.com/hole19/bisu/blob/main/CHANGELOG.md
|
|
93
|
+
bug_tracker_uri: https://github.com/hole19/bisu/issues
|
|
94
|
+
rubygems_mfa_required: 'true'
|
|
120
95
|
rdoc_options: []
|
|
121
96
|
require_paths:
|
|
122
97
|
- lib
|
|
@@ -131,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
131
106
|
- !ruby/object:Gem::Version
|
|
132
107
|
version: '0'
|
|
133
108
|
requirements: []
|
|
134
|
-
rubygems_version:
|
|
109
|
+
rubygems_version: 4.0.10
|
|
135
110
|
specification_version: 4
|
|
136
111
|
summary: A localization automation service
|
|
137
112
|
test_files: []
|
data/.github/workflows/test.yml
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: Test
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ "*" ]
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
matrix:
|
|
18
|
-
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4']
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v4
|
|
22
|
-
|
|
23
|
-
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
24
|
-
uses: ruby/setup-ruby@v1
|
|
25
|
-
with:
|
|
26
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
27
|
-
bundler-cache: true
|
|
28
|
-
|
|
29
|
-
- name: Run tests
|
|
30
|
-
run: bundle exec rake
|
data/.rspec
DELETED
data/.travis.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
language: ruby
|
data/Gemfile.lock
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
bisu (3.0.2)
|
|
5
|
-
colorize
|
|
6
|
-
csv
|
|
7
|
-
rubyzip (>= 2.0.0)
|
|
8
|
-
safe_yaml (>= 1.0.0)
|
|
9
|
-
|
|
10
|
-
GEM
|
|
11
|
-
remote: https://rubygems.org/
|
|
12
|
-
specs:
|
|
13
|
-
addressable (2.8.7)
|
|
14
|
-
public_suffix (>= 2.0.2, < 7.0)
|
|
15
|
-
bigdecimal (3.3.1)
|
|
16
|
-
colorize (1.1.0)
|
|
17
|
-
crack (1.0.0)
|
|
18
|
-
bigdecimal
|
|
19
|
-
rexml
|
|
20
|
-
csv (3.3.5)
|
|
21
|
-
diff-lcs (1.6.2)
|
|
22
|
-
hashdiff (1.2.1)
|
|
23
|
-
public_suffix (6.0.2)
|
|
24
|
-
rake (13.3.0)
|
|
25
|
-
rexml (3.4.4)
|
|
26
|
-
rspec (3.13.1)
|
|
27
|
-
rspec-core (~> 3.13.0)
|
|
28
|
-
rspec-expectations (~> 3.13.0)
|
|
29
|
-
rspec-mocks (~> 3.13.0)
|
|
30
|
-
rspec-core (3.13.5)
|
|
31
|
-
rspec-support (~> 3.13.0)
|
|
32
|
-
rspec-expectations (3.13.5)
|
|
33
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
34
|
-
rspec-support (~> 3.13.0)
|
|
35
|
-
rspec-its (2.0.0)
|
|
36
|
-
rspec-core (>= 3.13.0)
|
|
37
|
-
rspec-expectations (>= 3.13.0)
|
|
38
|
-
rspec-mocks (3.13.5)
|
|
39
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
|
-
rspec-support (~> 3.13.0)
|
|
41
|
-
rspec-support (3.13.6)
|
|
42
|
-
rubyzip (3.1.1)
|
|
43
|
-
safe_yaml (1.0.5)
|
|
44
|
-
webmock (3.25.1)
|
|
45
|
-
addressable (>= 2.8.0)
|
|
46
|
-
crack (>= 0.3.2)
|
|
47
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
|
48
|
-
|
|
49
|
-
PLATFORMS
|
|
50
|
-
ruby
|
|
51
|
-
|
|
52
|
-
DEPENDENCIES
|
|
53
|
-
bisu!
|
|
54
|
-
rake
|
|
55
|
-
rspec
|
|
56
|
-
rspec-its
|
|
57
|
-
webmock (~> 3)
|
|
58
|
-
|
|
59
|
-
BUNDLED WITH
|
|
60
|
-
2.4.22
|
data/README_explanation.png
DELETED
|
Binary file
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type: iOS
|
|
2
|
-
|
|
3
|
-
dictionary:
|
|
4
|
-
type: google_sheet
|
|
5
|
-
url: sheet-public-url
|
|
6
|
-
keys_column: "key name"
|
|
7
|
-
|
|
8
|
-
translate:
|
|
9
|
-
- in: hole19/Localizable.strings.translatable
|
|
10
|
-
out: hole19/%{locale}.lproj/Localizable.strings
|
|
11
|
-
- in: hole19/Countries.strings.translatable
|
|
12
|
-
out: hole19/%{locale}.lproj/Countries.strings
|
|
13
|
-
|
|
14
|
-
languages:
|
|
15
|
-
- locale: en
|
|
16
|
-
language: english
|
|
17
|
-
- locale: en-US
|
|
18
|
-
language: english-us
|
|
19
|
-
fallback_language: english
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"en": {
|
|
3
|
-
"kConnectFacebook": "Connect with Facebook",
|
|
4
|
-
"kNoNoNoMr": "No, no, no. Mr %{name} not here"
|
|
5
|
-
},
|
|
6
|
-
"ja": {
|
|
7
|
-
"kConnectFacebook": "\u30d5\u30a7\u30a4\u30b9\u30d6\u30c3\u30af\u3078\u63a5\u7d9a"
|
|
8
|
-
},
|
|
9
|
-
"fr": {
|
|
10
|
-
"kConnectFacebook": "Connexion par Facebook"
|
|
11
|
-
},
|
|
12
|
-
"de": {
|
|
13
|
-
"kConnectFacebook": "Mit Facebook verbinden"
|
|
14
|
-
},
|
|
15
|
-
"ko": {
|
|
16
|
-
"kConnectFacebook": "\ud398\uc774\uc2a4\ubd81\uc73c\ub85c \uc811\uc18d",
|
|
17
|
-
"kTwitterServer": "트위터 서버연결 실패. \\n잠시 후 재시도."
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"en": {
|
|
3
|
-
"translation": {
|
|
4
|
-
"kConnectFacebook": "Connect with Facebook",
|
|
5
|
-
"kNoNoNoMr": "No, no, no. Mr %{name} not here"
|
|
6
|
-
}
|
|
7
|
-
},
|
|
8
|
-
"ja": {
|
|
9
|
-
"translation": {
|
|
10
|
-
"kConnectFacebook": "\u30d5\u30a7\u30a4\u30b9\u30d6\u30c3\u30af\u3078\u63a5\u7d9a"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"fr": {
|
|
14
|
-
"translation": {
|
|
15
|
-
"kConnectFacebook": "Connexion par Facebook"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"de": {
|
|
19
|
-
"translation": {
|
|
20
|
-
"kConnectFacebook": "Mit Facebook verbinden"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"ko": {
|
|
24
|
-
"translation": {
|
|
25
|
-
"kConnectFacebook": "\ud398\uc774\uc2a4\ubd81\uc73c\ub85c \uc811\uc18d",
|
|
26
|
-
"kTwitterServer": ["트위터 서버연결 실패. ", "잠시 후 재시도."]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
Binary file
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
describe Bisu::Config do
|
|
2
|
-
subject(:config) { Bisu::Config.new(hash: hash) }
|
|
3
|
-
|
|
4
|
-
let(:hash) { {
|
|
5
|
-
type: "BisuOS",
|
|
6
|
-
dictionary: {
|
|
7
|
-
type: "google_sheet",
|
|
8
|
-
url: "https://abc1234567890",
|
|
9
|
-
keys_column: "key name",
|
|
10
|
-
},
|
|
11
|
-
translate: [
|
|
12
|
-
{ in: "path/to/file/to/1.ext.translatable",
|
|
13
|
-
out: "path/to/final-%{locale}/1.ext",
|
|
14
|
-
out_en_us: "path/to/default/1.ext"
|
|
15
|
-
},
|
|
16
|
-
{ in: "path/to/file/to/2.ext.translatable",
|
|
17
|
-
out: "path/to/final-%{locale}/2.ext",
|
|
18
|
-
out_en_us: "path/to/default/2.ext"
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
languages: [
|
|
22
|
-
{ locale: "en-US", language: "english" },
|
|
23
|
-
{ locale: "pt", language: "portuguese" },
|
|
24
|
-
{ locale: "pt-PT", language: "portuguese" },
|
|
25
|
-
{ locale: "pt-Batatas", language: "portuguese-bt", fallback_language: "portuguese" }
|
|
26
|
-
]
|
|
27
|
-
} }
|
|
28
|
-
|
|
29
|
-
context "when hash is missing params" do
|
|
30
|
-
before { hash.delete(:type) }
|
|
31
|
-
it { expect { config }.to raise_error /missing keys/i }
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
its(:to_h) { should eq(hash) }
|
|
35
|
-
its(:type) { should eq("BisuOS") }
|
|
36
|
-
|
|
37
|
-
describe "#dictionary" do
|
|
38
|
-
subject(:dictionary) { config.dictionary }
|
|
39
|
-
|
|
40
|
-
it { should eq({ type: "google_sheet", url: "https://abc1234567890", keys_column: "key name" }) }
|
|
41
|
-
|
|
42
|
-
context "when given a OneSky type dictionary" do
|
|
43
|
-
before do
|
|
44
|
-
hash[:dictionary] = {
|
|
45
|
-
type: "one_sky",
|
|
46
|
-
api_key: "as387oavh48",
|
|
47
|
-
api_secret: "bp0s5avo8a59",
|
|
48
|
-
project_id: 328742,
|
|
49
|
-
file_name: "file.json"
|
|
50
|
-
}
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it { should eq({ type: "one_sky", api_key: "as387oavh48", api_secret: "bp0s5avo8a59", project_id: 328742, file_name: "file.json" }) }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "when given a Url type dictionary" do
|
|
57
|
-
before do
|
|
58
|
-
hash[:dictionary] = {
|
|
59
|
-
type: "url",
|
|
60
|
-
url: "a_url"
|
|
61
|
-
}
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it { should eq({ type: "url", url: "a_url" }) }
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
context "when given an unknown type dictionary" do
|
|
68
|
-
before { hash[:dictionary] = { type: "i_dunno" } }
|
|
69
|
-
it { expect { config }.to raise_error /unknown dictionary type 'i_dunno'/i }
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
describe "#localize_files" do
|
|
74
|
-
it "yields 5 times with the expected arguments" do
|
|
75
|
-
expect { |b|
|
|
76
|
-
config.localize_files(&b)
|
|
77
|
-
}.to yield_successive_args(
|
|
78
|
-
["path/to/file/to/1.ext.translatable", "path/to/default/1.ext", "en-US", "english", nil ],
|
|
79
|
-
["path/to/file/to/1.ext.translatable", "path/to/final-pt/1.ext", "pt", "portuguese", nil ],
|
|
80
|
-
["path/to/file/to/1.ext.translatable", "path/to/final-pt-PT/1.ext", "pt-PT", "portuguese", nil ],
|
|
81
|
-
["path/to/file/to/1.ext.translatable", "path/to/final-pt-Batatas/1.ext", "pt-Batatas", "portuguese-bt", "portuguese"],
|
|
82
|
-
["path/to/file/to/2.ext.translatable", "path/to/default/2.ext", "en-US", "english", nil ],
|
|
83
|
-
["path/to/file/to/2.ext.translatable", "path/to/final-pt/2.ext", "pt", "portuguese", nil ],
|
|
84
|
-
["path/to/file/to/2.ext.translatable", "path/to/final-pt-PT/2.ext", "pt-PT", "portuguese", nil ],
|
|
85
|
-
["path/to/file/to/2.ext.translatable", "path/to/final-pt-Batatas/2.ext", "pt-Batatas", "portuguese-bt", "portuguese"]
|
|
86
|
-
)
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
describe Bisu::Dictionary do
|
|
2
|
-
subject(:dict) { Bisu::Dictionary.new(keys) }
|
|
3
|
-
|
|
4
|
-
describe ".initialize" do
|
|
5
|
-
let(:keys) { { "lang" => { "kNo1" => "text" } } }
|
|
6
|
-
it { expect { subject }.not_to raise_error }
|
|
7
|
-
|
|
8
|
-
context "when created with invalid type parameters" do
|
|
9
|
-
let(:keys) { "cenas" }
|
|
10
|
-
it { expect { subject }.to raise_error /expected Hash/ }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context "when created with an invalid json schema" do
|
|
14
|
-
let(:keys) { { "lang" => "text" } }
|
|
15
|
-
it { expect { subject }.to raise_error /lang.+expected Hash/ }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "when created with an invalid json schema" do
|
|
19
|
-
let(:keys) { { "a-lang" => { "kNo1" => { "wtvr" => "text" } } } }
|
|
20
|
-
it { expect { subject }.to raise_error /a-lang.+kNo1.+expected String/ }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context "when given empty translations" do
|
|
24
|
-
let(:keys) { { "lang" => { "kNo1" => nil } } }
|
|
25
|
-
it { expect { subject }.not_to raise_error }
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe "#has_language?" do
|
|
30
|
-
let(:keys) { {
|
|
31
|
-
"lang1" => { "kNo1" => "no1-lang1" },
|
|
32
|
-
"lang2" => { "kNo1" => "no1-lang2", "kNo2" => "no1-lang2" },
|
|
33
|
-
"lang3" => { "kNo2" => "no2-lang3" }
|
|
34
|
-
} }
|
|
35
|
-
|
|
36
|
-
it "returns true if that language is translated" do
|
|
37
|
-
expect(dict.has_language?("lang2")).to be true
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "returns true if that language is only partially translated" do
|
|
41
|
-
expect(dict.has_language?("lang3")).to be true
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "returns false if that language does not exist in any key" do
|
|
45
|
-
expect(dict.has_language?("lang-no-available")).to be false
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "returns true if that language is in another case" do
|
|
49
|
-
expect(dict.has_language?("Lang2")).to be true
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe "#localize" do
|
|
54
|
-
let(:keys) { {
|
|
55
|
-
"english" => { "kCray" => "You are crazy!" },
|
|
56
|
-
"portuguese" => { "kCray" => "Estás maluco!" },
|
|
57
|
-
"kriolo" => { "kCray" => "Bo sta crazy!" }
|
|
58
|
-
} }
|
|
59
|
-
|
|
60
|
-
it "localizes a key" do
|
|
61
|
-
expect(dict.localize("kriolo", "kCray")).to eq "Bo sta crazy!"
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "returns nil when the key does not exist" do
|
|
65
|
-
expect(dict.localize("kriolo", "kDoesntExist")).to be nil
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it "returns nil when language is not available" do
|
|
69
|
-
expect(dict.localize("finish", "kCray")).to be nil
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
it "localizes a key when the language is in another case" do
|
|
73
|
-
expect(dict.localize("krioLo", "kCray")).to eq "Bo sta crazy!"
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|