wovnrb 2.2.3 → 3.0.1

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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +5 -0
  3. data/README.en.md +198 -0
  4. data/README.ja.md +180 -0
  5. data/README.md +1 -0
  6. data/docker/docker-compose.yml +11 -0
  7. data/docker/rails/Dockerfile +6 -0
  8. data/docker/rails/TestSite/.browserslistrc +1 -0
  9. data/docker/rails/TestSite/.gitignore +63 -0
  10. data/docker/rails/TestSite/Gemfile +56 -0
  11. data/docker/rails/TestSite/README.md +24 -0
  12. data/docker/rails/TestSite/Rakefile +6 -0
  13. data/docker/rails/TestSite/app/assets/config/manifest.js +2 -0
  14. data/docker/rails/TestSite/app/assets/images/.keep +0 -0
  15. data/docker/rails/TestSite/app/assets/stylesheets/application.css +15 -0
  16. data/docker/rails/TestSite/app/assets/stylesheets/redirects.scss +3 -0
  17. data/docker/rails/TestSite/app/channels/application_cable/channel.rb +4 -0
  18. data/docker/rails/TestSite/app/channels/application_cable/connection.rb +4 -0
  19. data/docker/rails/TestSite/app/controllers/application_controller.rb +2 -0
  20. data/docker/rails/TestSite/app/controllers/concerns/.keep +0 -0
  21. data/docker/rails/TestSite/app/controllers/pages_controller.rb +7 -0
  22. data/docker/rails/TestSite/app/controllers/redirects_controller.rb +5 -0
  23. data/docker/rails/TestSite/app/helpers/application_helper.rb +2 -0
  24. data/docker/rails/TestSite/app/helpers/pages_helper.rb +2 -0
  25. data/docker/rails/TestSite/app/helpers/redirects_helper.rb +2 -0
  26. data/docker/rails/TestSite/app/javascript/channels/consumer.js +6 -0
  27. data/docker/rails/TestSite/app/javascript/channels/index.js +5 -0
  28. data/docker/rails/TestSite/app/javascript/packs/application.js +17 -0
  29. data/docker/rails/TestSite/app/jobs/application_job.rb +7 -0
  30. data/docker/rails/TestSite/app/mailers/application_mailer.rb +4 -0
  31. data/docker/rails/TestSite/app/models/application_record.rb +3 -0
  32. data/docker/rails/TestSite/app/models/concerns/.keep +0 -0
  33. data/docker/rails/TestSite/app/views/layouts/application.html.erb +15 -0
  34. data/docker/rails/TestSite/app/views/layouts/mailer.html.erb +13 -0
  35. data/docker/rails/TestSite/app/views/layouts/mailer.text.erb +1 -0
  36. data/docker/rails/TestSite/babel.config.js +72 -0
  37. data/docker/rails/TestSite/bin/bundle +114 -0
  38. data/docker/rails/TestSite/bin/rails +4 -0
  39. data/docker/rails/TestSite/bin/rake +4 -0
  40. data/docker/rails/TestSite/bin/setup +36 -0
  41. data/docker/rails/TestSite/bin/webpack +18 -0
  42. data/docker/rails/TestSite/bin/webpack-dev-server +18 -0
  43. data/docker/rails/TestSite/bin/yarn +11 -0
  44. data/docker/rails/TestSite/config.ru +5 -0
  45. data/docker/rails/TestSite/config/application.rb +26 -0
  46. data/docker/rails/TestSite/config/boot.rb +4 -0
  47. data/docker/rails/TestSite/config/cable.yml +10 -0
  48. data/docker/rails/TestSite/config/credentials.yml.enc +1 -0
  49. data/docker/rails/TestSite/config/database.yml +25 -0
  50. data/docker/rails/TestSite/config/environment.rb +5 -0
  51. data/docker/rails/TestSite/config/environments/development.rb +62 -0
  52. data/docker/rails/TestSite/config/environments/production.rb +112 -0
  53. data/docker/rails/TestSite/config/environments/test.rb +49 -0
  54. data/docker/rails/TestSite/config/initializers/application_controller_renderer.rb +8 -0
  55. data/docker/rails/TestSite/config/initializers/assets.rb +14 -0
  56. data/docker/rails/TestSite/config/initializers/backtrace_silencers.rb +7 -0
  57. data/docker/rails/TestSite/config/initializers/content_security_policy.rb +30 -0
  58. data/docker/rails/TestSite/config/initializers/cookies_serializer.rb +5 -0
  59. data/docker/rails/TestSite/config/initializers/filter_parameter_logging.rb +4 -0
  60. data/docker/rails/TestSite/config/initializers/inflections.rb +16 -0
  61. data/docker/rails/TestSite/config/initializers/mime_types.rb +4 -0
  62. data/docker/rails/TestSite/config/initializers/wrap_parameters.rb +14 -0
  63. data/docker/rails/TestSite/config/locales/en.yml +33 -0
  64. data/docker/rails/TestSite/config/puma.rb +38 -0
  65. data/docker/rails/TestSite/config/routes.rb +4 -0
  66. data/docker/rails/TestSite/config/spring.rb +6 -0
  67. data/docker/rails/TestSite/config/storage.yml +34 -0
  68. data/docker/rails/TestSite/config/webpack/development.js +5 -0
  69. data/docker/rails/TestSite/config/webpack/environment.js +3 -0
  70. data/docker/rails/TestSite/config/webpack/production.js +5 -0
  71. data/docker/rails/TestSite/config/webpack/test.js +5 -0
  72. data/docker/rails/TestSite/config/webpacker.yml +96 -0
  73. data/docker/rails/TestSite/db/seeds.rb +7 -0
  74. data/docker/rails/TestSite/lib/assets/.keep +0 -0
  75. data/docker/rails/TestSite/lib/tasks/.keep +0 -0
  76. data/docker/rails/TestSite/log/.keep +0 -0
  77. data/docker/rails/TestSite/package.json +15 -0
  78. data/docker/rails/TestSite/postcss.config.js +12 -0
  79. data/docker/rails/TestSite/public/index.html +9 -0
  80. data/docker/rails/TestSite/public/page.html +13 -0
  81. data/docker/rails/TestSite/public/pages/files/plaintext_unicode.txt +204 -0
  82. data/docker/rails/TestSite/public/pages/files/simple_css.css +8 -0
  83. data/docker/rails/TestSite/public/pages/files/simple_javascript.js +2 -0
  84. data/docker/rails/TestSite/public/pages/html5test.html +555 -0
  85. data/docker/rails/TestSite/public/pages/oldhtml.html +335 -0
  86. data/docker/rails/TestSite/public/pages/xhtml.xhtml +726 -0
  87. data/docker/rails/TestSite/public/redirection_target.html +10 -0
  88. data/docker/rails/TestSite/public/testdir/testpage-dir.html +9 -0
  89. data/docker/rails/TestSite/public/testdir/testpage-redirect-destination.html +9 -0
  90. data/docker/rails/TestSite/public/testpage.html +9 -0
  91. data/docker/rails/TestSite/public/wovn_index.html +24 -0
  92. data/docker/rails/TestSite/start.sh +13 -0
  93. data/docker/rails/TestSite/storage/.keep +0 -0
  94. data/docker/rails/TestSite/test/application_system_test_case.rb +5 -0
  95. data/docker/rails/TestSite/test/channels/application_cable/connection_test.rb +11 -0
  96. data/docker/rails/TestSite/test/controllers/.keep +0 -0
  97. data/docker/rails/TestSite/test/controllers/pages_controller_test.rb +7 -0
  98. data/docker/rails/TestSite/test/controllers/redirects_controller_test.rb +7 -0
  99. data/docker/rails/TestSite/test/fixtures/.keep +0 -0
  100. data/docker/rails/TestSite/test/fixtures/files/.keep +0 -0
  101. data/docker/rails/TestSite/test/helpers/.keep +0 -0
  102. data/docker/rails/TestSite/test/integration/.keep +0 -0
  103. data/docker/rails/TestSite/test/mailers/.keep +0 -0
  104. data/docker/rails/TestSite/test/models/.keep +0 -0
  105. data/docker/rails/TestSite/test/system/.keep +0 -0
  106. data/docker/rails/TestSite/test/test_helper.rb +13 -0
  107. data/docker/rails/TestSite/yarn.lock +7642 -0
  108. data/lib/wovnrb.rb +1 -1
  109. data/lib/wovnrb/api_translator.rb +1 -1
  110. data/lib/wovnrb/headers.rb +1 -23
  111. data/lib/wovnrb/lang.rb +77 -40
  112. data/lib/wovnrb/railtie.rb +1 -15
  113. data/lib/wovnrb/services/html_converter.rb +9 -10
  114. data/lib/wovnrb/store.rb +3 -3
  115. data/lib/wovnrb/version.rb +1 -1
  116. data/makefile +16 -0
  117. data/test/lib/headers_test.rb +7 -25
  118. data/test/lib/lang_test.rb +10 -40
  119. data/test/lib/services/html_converter_test.rb +39 -17
  120. data/test/lib/store_test.rb +2 -1
  121. data/wovnrb.gemspec +3 -3
  122. metadata +114 -11
  123. data/README.md +0 -182
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7142c7b987c9c606c3e49258ed9e0aff9948da0fb72b20f0cc830e3c0c65de1
4
- data.tar.gz: 70868e06450c6e67a01c277403993c75432793f2a985bfdd76dac92731cc6e4a
3
+ metadata.gz: 0b52fa4c2f9eb449a733283bbe12420dcf4f60dd606ade7f919ffa43274659d4
4
+ data.tar.gz: e5b4113a7e9e09aa352efc2a53cbafa26930f3aca5f4ade9e2fe0b46e7754686
5
5
  SHA512:
6
- metadata.gz: 7b3667f117278b2646b38b80488aa74f18af0bec771d3ba09bd3232a83d6175fbed349ab2ff6912f2e3201000be11590a4a83a9cb015c8cebbc2a388f66cbac3
7
- data.tar.gz: c162e510d61ab75be43cb0e1ee8fa1e6ffd3b986b200d90b65cb1744128e87f6bc433fa4a231c69ef825a07de500c58ed3ce2c20d962fb3c2a84ae4b8157f9c6
6
+ metadata.gz: 9010845d1a66b75de3093a5446571081598092183db5c02b8299492bc09319ab9372782467c694c2c86f62d4dd21238c31770267871542c819c87748ac4f4c20
7
+ data.tar.gz: 712d54ef68e854dec1017ef57bb147924fcbc4ecdb456af2d797aeb497a8d469045c35b9e5dd41d6dda0c74c6659f32c7560c236c0b1a3c4c1baa9961c479df9
data/.rubocop_todo.yml CHANGED
@@ -308,3 +308,8 @@ Style/NumericPredicate:
308
308
 
309
309
  Style/SafeNavigation:
310
310
  Enabled: false
311
+
312
+ AllCops:
313
+ Exclude:
314
+ - 'docker/**/*'
315
+ - 'vendor/**/*'
data/README.en.md ADDED
@@ -0,0 +1,198 @@
1
+ # WOVN.io Ruby Library
2
+
3
+ The WOVN.io Ruby library is a library that uses WOVN.io in order to provide translations. The WOVN.io Ruby Library is packaged as Rack Middleware.
4
+
5
+ This document explains the process of installing WOVN.io Ruby, as well as set up and configuration process.
6
+
7
+ ## 1. Install
8
+
9
+ ### 1.1. Creating a WOVN.io account.
10
+
11
+ In order to use the WOVN.io Ruby Library, you need a WOVN.io account. If you do not have an account, please first sign up for one at WOVN.io.
12
+
13
+ ### 1.2. Adding a Page
14
+
15
+ After logging into WOVN.io, add a page that you would like translated.
16
+
17
+ ### 1.3. Ruby Application Settings
18
+
19
+ To use the WOVN.io Ruby Library, insert the following line into your Ruby Application's Gemfile. WOVN.io currently supports version 2.0.1 and up.
20
+
21
+ ```ruby
22
+ gem 'wovnrb', '>= 2.0.1'
23
+ ```
24
+
25
+ After setting the above, execute the following command to install the WOVN.io Ruby Library.
26
+
27
+ ```bash
28
+ bundle install
29
+ ```
30
+
31
+ After installing the library, insert the following into your Ruby Application's settings file.
32
+
33
+ * If you're using Ruby on Rails
34
+
35
+ Insert the following into either config/application.rb or config/environments/.
36
+
37
+ ```ruby
38
+ ...
39
+
40
+ config.wovnrb = {
41
+ :project_token => 'EnS!t3',
42
+ :default_lang => 'en',
43
+ :supported_langs => ['en'],
44
+ :url_pattern => 'path'
45
+ }
46
+
47
+ ...
48
+ ```
49
+
50
+ The WOVN.rb Rails middleware must also be installed. See [2.10 - install_middleware](#2.10-install_middleware)
51
+
52
+ * If you're using Sinatra
53
+
54
+ Insert the following into either the Application File or config.ru.
55
+
56
+ ```ruby
57
+ ...
58
+
59
+ require 'wovnrb'
60
+
61
+ use Wovnrb::Interceptor, {
62
+ :project_token => 'EnS!t3',
63
+ :default_lang => 'en',
64
+ :supported_langs => ['en'],
65
+ :url_pattern => 'path'
66
+ }
67
+
68
+ ...
69
+ ```
70
+
71
+ After completing setup, start the Ruby Application, and make sure the WOVN.io library is working correctly.
72
+
73
+ ## 2. Parameter Setting
74
+
75
+ The following is a list of the WOVN.io Ruby Library's valid parameters.
76
+
77
+ Parameter Name | Required | Default Setting
78
+ ------------------ | -------- | ----------------
79
+ project_token | yes | ''
80
+ default_lang | yes | 'en'
81
+ supported_langs | yes | ['en']
82
+ url_pattern | yes | 'path'
83
+ lang_param_name | | 'wovn'
84
+ query | | []
85
+ ignore_class | | []
86
+ translate_fragment | | true
87
+ ignore_paths | | []
88
+ install_middleware | | true
89
+
90
+ ### 2.1. project_token
91
+
92
+ Set your WOVN.io Account's Project token. This parameter is required.
93
+
94
+ ### 2.2. default_lang
95
+
96
+ This sets the Ruby application's default language. The default value is English ('en').
97
+
98
+ If, for a requested page, the default language parameter is included in the URL, the request is redirected before translating. The default_lang parameter is used for this purpose.
99
+
100
+ If the default_lang is set to 'en', when receiving a request for the following URL,
101
+
102
+ https://wovn.io/en/contact
103
+
104
+ Then the library will redirect to the following URL.
105
+
106
+ https://wovn.io/contact
107
+
108
+ ### 2.3. supported_langs
109
+ This tells the library which languages are being used on the website (including
110
+ the original language). This setting allows for inserting metadata necessary for
111
+ SEO (Search Engine Optimization).
112
+
113
+ If your website is in English and you are using WOVN.io to localize it in
114
+ Japanese, then you should use the following setting:
115
+ ```
116
+ :supported_langs => ['en', 'ja']
117
+ ```
118
+ **Note:** The order of the languages in the list does not matter.
119
+
120
+ ### 2.4. url_pattern
121
+
122
+ The Library works in the Ruby Application by adding new URLs to be translated. You can set the type of url with the `url_pattern` parameter. There are 3 types that can be set.
123
+
124
+ parameters | Translated page's URL | Notes
125
+ ----------- | ------------------------------- | -------
126
+ 'path' | https://wovn.io/ja/contact | Default Value. If no settings have been set, url_pattern defaults to this value.
127
+ 'subdomain' | https://ja.wovn.io/contact | DNS settings must be set.
128
+ 'query' | https://wovn.io/contact?wovn=ja | The least amount of changes to the application required to complete setup.
129
+
130
+ ※ The following is an example of a URL that has been translated by the library using the above URLs.
131
+
132
+ https://wovn.io/contact
133
+
134
+ ### 2.5 lang_param_name
135
+ This parameter is only valid for when `url_pattern` is set to `'query'`.
136
+
137
+ It allows you to set the query parameter name for declaring the language of the
138
+ page. The default value for this setting is `'wovn'`, such that a page URL in
139
+ translated language English has the form
140
+ `https://my-website.com/index.php?wovn=en`. If you instead set the value to
141
+ `'lang'`, then the later URL example would have the form
142
+ `https://my-website.com/index.php?lang=en`.
143
+
144
+ ### 2.6. query
145
+
146
+ WOVN.io ignores query parameters when searching a translated page. If you want to add a query parameter to translated page's URL, you should configure the `query` parameter. (You need to configure WOVN.io too)
147
+
148
+ https://wovn.io/ja/contact?os=mac&keyboard=us
149
+
150
+ If the `default_lang` is 'en', and the query is set to '', the above URL will be modified into the following URL to search for the page's translation.
151
+
152
+ https://wovn.io/contact
153
+
154
+ If the `default_lang` is 'en', and the query is set to 'os', the above URL will be modified into the following URL to search for the page's translation.
155
+
156
+ https://wovn.io/contact?os=mac
157
+
158
+ ### 2.7. ignore_class
159
+
160
+ This sets "Ignore class" which prevents WOVN from translating HTML elements that have a class contained in this array.
161
+
162
+ ### 2.8. translate_fragment
163
+
164
+ This option allows to disable translating partial HTML content. By default,
165
+ partial HTML content is translated but no widget snippet is added. Set
166
+ `translate_fragment` to `false` to prevent translating partial HTML content.
167
+
168
+ ### 2.9 ignore_paths
169
+
170
+ This parameter tells WOVN.rb to not localize content withing given directories.
171
+
172
+ The directories given will only be matched against the beginning of the URL path.
173
+
174
+ For instance, if you want to not localize the admin directory of your website, you should add the following to you WOVN.rb configuration.
175
+ ```
176
+ 'ignore_paths' => ['/admin/']
177
+ ```
178
+
179
+ ### 2.10 install_middleware
180
+
181
+ When using WOVN.rb in a Rails environment, this parameter controls whether the WOVN.rb middleware will be automatically installed or not.
182
+
183
+ By default, WOVN.rb is automatically installed as the first middleware.
184
+ If you are using Rack::Deflater or other middleware that needs to be executed first, set this parameter to `false` and manually insert the middleware appropriately.
185
+ WOVN.rb needs to be added after any compression middleware.
186
+
187
+ ```ruby
188
+ config.middleware.use Rack::Deflater
189
+ config.middleware.insert_after Rack::Deflater, Wovnrb::Interceptor
190
+
191
+ config.wovnrb = {
192
+ :project_token => 'EnS!t3',
193
+ :default_lang => 'en',
194
+ :supported_langs => ['en'],
195
+ :url_pattern => 'path',
196
+ :install_middleware => false
197
+ }
198
+ ```
data/README.ja.md ADDED
@@ -0,0 +1,180 @@
1
+ # WOVN.io Ruby Library
2
+
3
+ For English users: [English](README.en.md)
4
+
5
+ WOVN.io Rubyライブラリは、翻訳を提供するためにWOVN.ioを利用したライブラリです。
6
+ WOVN.io Ruby ライブラリは Rack Middleware としてパッケージ化されています。
7
+
8
+ このドキュメントでは、WOVN.io Rubyをインストールするまでの手順や、セットアップ・設定の流れを説明しています。
9
+
10
+ ## 1. インストール
11
+
12
+ ### 1.1. WOVN.ioアカウントを作成
13
+
14
+ WOVN.io Ruby Libraryを利用するには、WOVN.ioのアカウントが必要です。
15
+ アカウントをお持ちでない方は、まずはWOVN.ioに登録してください。
16
+
17
+ ### 1.2. ページ追加
18
+
19
+ WOVN.ioにログイン後、翻訳したいページを追加します。
20
+
21
+ ### 1.3. Rubyアプリケーションの設定
22
+
23
+ WOVN.io Ruby ライブラリを使用するには、以下の行を Ruby アプリケーションの Gemfile に挿入します。
24
+ WOVN.ioは現在、バージョン2.0.1以上をサポートしています。
25
+
26
+ ```ruby
27
+ gem 'wovnrb', '>= 2.0.1'
28
+ ```
29
+
30
+ 以上の設定を行った後、以下のコマンドを実行して、WOVN.io Rubyライブラリをインストールします。
31
+
32
+ ```bash
33
+ bundle install
34
+ ```
35
+
36
+ ライブラリをインストールしたら、Rubyアプリケーションの設定ファイルに以下を挿入します。
37
+
38
+ * Ruby on Rails を使っている場合
39
+
40
+ `config/application.rb` または `config/environments/` に以下を挿入します。
41
+
42
+ ```ruby
43
+ ...
44
+
45
+ config.wovnrb = {
46
+ :project_token => 'EnS!t3',
47
+ :default_lang => 'en',
48
+ :supported_langs => ['en'],
49
+ :url_pattern => 'path'
50
+ }
51
+
52
+ ...
53
+ ```
54
+
55
+ * Sinatra を使っている場合
56
+
57
+ アプリケーション・ファイルまたは `config.ru` のいずれかに以下を挿入します。
58
+
59
+ ```ruby
60
+ ...
61
+
62
+ require 'wovnrb'
63
+
64
+ use Wovnrb::Interceptor, {
65
+ :project_token => 'EnS!t3',
66
+ :default_lang => 'en',
67
+ :supported_langs => ['en'],
68
+ :url_pattern => 'path'
69
+ }
70
+
71
+ ...
72
+ ```
73
+
74
+ セットアップが完了したら、Rubyアプリケーションを起動し、WOVN.ioライブラリが正常に動作していることを確認します。
75
+
76
+ ## 2. パラメータ設定
77
+
78
+ 以下に、WOVN.io Ruby ライブラリの有効なパラメータの一覧を示します。
79
+
80
+ パラメータ名 | 必須 | デフォルト設定
81
+ ------------------ | -------- | ----------------
82
+ project_token | yes | ''
83
+ default_lang | yes | 'en'
84
+ supported_langs | yes | ['en']
85
+ url_pattern | yes | 'path'
86
+ lang_param_name | | 'wovn'
87
+ query | | []
88
+ ignore_class | | []
89
+ translate_fragment | | true
90
+ ignore_paths | | []
91
+
92
+ ### 2.1. project_token
93
+
94
+ WOVN.ioアカウントのプロジェクトトークンを設定します。このパラメータは必須です。
95
+
96
+ ### 2.2. default_lang
97
+
98
+ これはRubyアプリケーションのデフォルト言語を設定します。デフォルト値は英語('en')です。
99
+
100
+ リクエストされたページで、デフォルトの言語パラメータが URL に含まれている場合、リクエストは翻訳前にリダイレクトされます。
101
+ このために `default_lang` パラメータを使用します。
102
+
103
+ `default_lang` が 'en' に設定されている時に、以下のURLへのリクエストを受信した場合。
104
+
105
+ https://wovn.io/en/contact
106
+
107
+ ライブラリは以下のURLにリダイレクトされます。
108
+
109
+ https://wovn.io/contact
110
+
111
+ ### 2.3. supported_langs
112
+
113
+ これは、ウェブサイトで使用されている言語(翻訳元を含む)をライブラリに伝えます。
114
+ この設定では、SEO(検索エンジン最適化)に必要なメタデータを挿入することができます。
115
+
116
+ ウェブサイトが英語で、WOVN.ioを使って日本語にローカライズしている場合は、以下の設定にしてください。
117
+ ```
118
+ :supported_langs => ['en', 'ja']
119
+ ```
120
+ **注意:** 配列の言語の順番は関係ありません。
121
+
122
+ ### 2.4. url_pattern
123
+
124
+ ライブラリはRubyアプリケーションの中で、翻訳されるURLを新たに追加することで動作します。
125
+ urlの種類は `url_pattern` パラメータで設定できます。設定できるタイプは3種類。
126
+
127
+
128
+ パラメータ | 翻訳されたページのURL | 備考
129
+ ----------- | ------------------------------- | -------
130
+ 'path' | https://wovn.io/ja/contact | デフォルト値、何も設定されていない場合、 `url_pattern` のデフォルト値はこの値になります
131
+ 'subdomain' | https://ja.wovn.io/contact | DNSの設定が必要です
132
+ 'query' | https://wovn.io/contact?wovn=ja | セットアップを完了するために必要なアプリケーションへの変更の最小量
133
+
134
+ ※ 上記は、以下のURLを使用してライブラリが翻訳したURLの例です。
135
+
136
+ https://wovn.io/contact
137
+
138
+ ### 2.5 lang_param_name
139
+
140
+ このパラメータは `url_pattern` が `query` に設定されている場合のみ有効です。
141
+
142
+ ページの言語を指定するためのクエリパラメータ名を設定することができます。
143
+
144
+ この設定のデフォルト値は `wovn` であり、翻訳された英語のページのURLが `https://my-website.com/index.php?wovn=en` という形式になります。
145
+ 代わりに `lang` に値を設定すると、URLの例は `https://my-website.com/index.php?lang=en` という形式になります。
146
+
147
+ ### 2.6. query
148
+
149
+ WOVN.ioは翻訳されたページを検索する際にクエリパラメータを無視します。
150
+ 翻訳ページのURLにクエリパラメータを追加したい場合は、`query` パラメータを設定する必要があります。(WOVN.ioも設定する必要があります)
151
+
152
+ https://wovn.io/ja/contact?os=mac&keyboard=us
153
+
154
+ `default_lang` が `en` でクエリが空に設定されている場合、上記のURLは以下のURLに変更され、ページの翻訳を検索するようになります。
155
+
156
+ https://wovn.io/contact
157
+
158
+ `default_lang` が `en` でクエリが `os` に設定されている場合、上記のURLは以下のURLに変更され、ページの翻訳を検索するようになります。
159
+
160
+ https://wovn.io/contact?os=mac
161
+
162
+ ### 2.7. ignore_class
163
+
164
+ これは「無視するクラス」を設定し、WOVNがこの配列に含まれるクラスを持つHTML要素を変換できないようにします。
165
+
166
+ ### 2.8. translate_fragment
167
+
168
+ このオプションでは、部分的なHTMLコンテンツの翻訳を無効にすることができます。
169
+ デフォルトでは、部分的なHTMLコンテンツは翻訳されますが、ウィジェットのスニペットは追加されません。
170
+ `translate_fragment` を `false` に設定すると、HTMLの一部が翻訳されないようになります。
171
+
172
+ ### 2.9 ignore_paths
173
+
174
+ このパラメータは、WOVN.rbが指定されたディレクトリ内のコンテンツをローカライズしないように指示します。
175
+ 指定されたディレクトリは、URLパスの先頭にのみマッチします。
176
+ 例えば、ウェブサイトの管理者ディレクトリをローカライズしたくない場合は、WOVN.rbの設定に次のように追加します。
177
+
178
+ ```
179
+ 'ignore_paths' => ['/admin/']
180
+ ```
data/README.md ADDED
@@ -0,0 +1 @@
1
+ ./README.ja.md
@@ -0,0 +1,11 @@
1
+ version: '3'
2
+ services:
3
+ rails:
4
+ container_name: wovntest-rails
5
+ build:
6
+ context: ./rails
7
+ dockerfile: Dockerfile
8
+ ports:
9
+ - 4000:4000
10
+ volumes:
11
+ - ../:/usr/src/app/wovnrb
@@ -0,0 +1,6 @@
1
+ FROM ruby:2.6.5
2
+
3
+ WORKDIR /usr/src/app
4
+
5
+ COPY ./TestSite/ .
6
+ CMD ["/bin/bash", "start.sh"]
@@ -0,0 +1 @@
1
+ defaults
@@ -0,0 +1,63 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+ /db/*.sqlite3-*
14
+
15
+ # Ignore all logfiles and tempfiles.
16
+ /log/*
17
+ /tmp/*
18
+ !/log/.keep
19
+ !/tmp/.keep
20
+
21
+ # Ignore pidfiles, but keep the directory.
22
+ /tmp/pids/*
23
+ !/tmp/pids/
24
+ !/tmp/pids/.keep
25
+
26
+ # Ignore uploaded files in development.
27
+ /storage/*
28
+ !/storage/.keep
29
+
30
+ /public/assets
31
+ .byebug_history
32
+
33
+ # Ignore master key for decrypting credentials and more.
34
+ /config/master.key
35
+
36
+ /public/packs
37
+ /public/packs-test
38
+ /node_modules
39
+ /yarn-error.log
40
+ yarn-debug.log*
41
+ .yarn-integrity
42
+ /.bundle/
43
+ /vendor
44
+ .yardoc/
45
+ /Gemfile.lock
46
+ /_yardoc/
47
+ /coverage/
48
+ doc/
49
+ /pkg/
50
+ /spec/reports/
51
+ /tmp/
52
+ *.bundle
53
+ *.so
54
+ *.o
55
+ *.a
56
+ *.swp
57
+ mkmf.log
58
+ .idea/
59
+ *.iml
60
+ .ruby-version
61
+ /*.gem
62
+ wovn_error.log
63
+ .byebug_history