new MultiLanguagesURL(options)
The class of the multilanguage page location url.
Extracts from `window.location.pathname` one of the list of valid languages and insertes it at the beginning of the incoming location url.
Forms the base of the path `this.rootLanguagePath` for subsequent substitution to the incoming location url.
This:
Parameters:
Name |
Type |
Description |
options |
Object
|
Required. Parameter object. Comprises:
Properties
Name |
Type |
Description |
languages |
Array
|
Required. List of allowed languages. |
pathname |
String
|
Optional. The default path is `window.location.pathname`. |
|
- Author:
-
- Alexander Ivannikov <a.n.ivannikov@yandex.ru> (https://github.com/an-ivannikov)
- Source:
Methods
url(location) → {String}
The method substitutes the created path base to the incoming location url.
This:
Parameters:
Name |
Type |
Description |
location |
Object
|
Required. The reference object is similar to `window.location`. Comprises:
Properties
Name |
Type |
Description |
pathname |
String
|
Required. The path is similar to `window.location.pathname`. |
search |
String
|
Optional. The request is similar to `window.location.search`. |
hash |
String
|
Optional. The hash is similar to `window.location.hash`. |
|
- Source:
Returns:
A reference of the form `this.rootLanguagePath` + `/pathname` + `search` +` hash`.
-
Type
-
String