WOVN.rb
The WOVN.io Ruby library is a Ruby library that uses WOVN.io server-side in order to provide translations. The WOVN.io Ruby Library is packaged as Rack Middleware.
Parameter Setting
Parameter Name | Required | Default Setting |
user_token | yes | ‘ ‘ |
url_pattern | yes | ‘path’ |
query | [] | |
default_lang | yes | ‘en’ |
cache_megabytes | 200 | |
ttl_seconds | 300 | |
use_proxy | false |
- user_token
Set your WOVN.io account’s user token. This parameter is required. - url_pattern
The library works in the Ruby application by detecting/adding URL’s for translation. You can set the type of url with the url_pattern parameter. There are 3 types that can be set.Parameter Name Translated page’s URL Notes ‘path’ https://wovn.io/ja/contact Default Value. If no settings have been set, url_pattern defaults to this value. ‘subdomain’ https://ja.wovn.io/contact The server’s DNS settings must be configured. ‘query’ https://wovn.io/contact?wovn=ja Minimal changes to the application. - query
When WOVN.io identifies a page for translation, it ignores the query parameter. If you want to include a query parameter within the URL, you must set it using the “query” parameter. (You must set this on WOVN.io’s side)https://wovn.io/ja/contact?os=mac&keyboard=us
If the defualt_lang is ‘en’, and query is set to [] (unset), the above URL will be modified into the following URL to search for the page’s translation.
https://wovn.io/contact
If the default_lang is ‘en’, and query is set to [‘os’], the above URL will be modified into the following URL to search for the page’s translation.
https://wovn.io/contact?os=mac
- default_lang
This sets the Ruby application’s default language. The default language is english (‘en’).
If a requested page’s URL’s language parameter is the same as the default language, the request is redirected before translating. The default_lang parameter is used for this purpose.If the default_lang is ‘en’, and a request is made for the following URL:
https://wovn.io/en/contact
The library will redirect to the following URL.
https://wovn.io/contact
- cache_megabytes, ttl_seconds
You can set the maximum cache size and cache lifetime for your page’s translation data. - use_proxy
When using a reverse proxy, if the WOVN.io Ruby Library is not given an appropriate host name, the page’s translation data may not be accessible. If you set useProxy to true, during the WOVN.io Ruby Library’s processing, it will use the HTTP Request Header’s X-Forwarded-Host in order to receive the translation data.