i18n fix and Ukranian lang
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -98,20 +98,27 @@ a {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
margin: 10px;
|
||||||
|
z-index: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
.languages > a {
|
.languages > a {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: inline-block;
|
||||||
margin: 10px;
|
padding: 5px;
|
||||||
padding: 10px;
|
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.languages img {
|
.languages img {
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.languages .selected {
|
||||||
|
background: rgb(233, 233, 233);
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 50%);
|
||||||
|
}
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
margin: 32px auto;
|
margin: 32px auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
9
src/output/helpers.js
Normal file
9
src/output/helpers.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
function ifEq (a, b, opts) {
|
||||||
|
if (a === b) {
|
||||||
|
return opts.fn(this)
|
||||||
|
} else {
|
||||||
|
return opts.inverse(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { ifEq }
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"en": {
|
"en": {
|
||||||
|
"link": "index",
|
||||||
"title": "Market Gaps",
|
"title": "Market Gaps",
|
||||||
"description": "Find a profitable difference between the price of the set and the price of the sum of it's parts.",
|
"description": "Find a profitable difference between the price of the set and the price of the sum of it's parts.",
|
||||||
"filter_by_difference": "Filter by difference:",
|
"filter_by_difference": "Filter by difference:",
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
"generated_at": "Generated at"
|
"generated_at": "Generated at"
|
||||||
},
|
},
|
||||||
"ru": {
|
"ru": {
|
||||||
|
"link": "ru",
|
||||||
"title": "Market Gaps",
|
"title": "Market Gaps",
|
||||||
"description": "Находите выгоду между покупкой сета по отдельности и продажей его в собранном виде.",
|
"description": "Находите выгоду между покупкой сета по отдельности и продажей его в собранном виде.",
|
||||||
"filter_by_difference": "Фильтровать по разнице:",
|
"filter_by_difference": "Фильтровать по разнице:",
|
||||||
@@ -18,5 +20,16 @@
|
|||||||
"set_price": "Стоимость сета",
|
"set_price": "Стоимость сета",
|
||||||
"difference": "Разница",
|
"difference": "Разница",
|
||||||
"generated_at": "Сгенерировано в"
|
"generated_at": "Сгенерировано в"
|
||||||
|
},
|
||||||
|
"ua": {
|
||||||
|
"link": "ua",
|
||||||
|
"title": "Market Gaps",
|
||||||
|
"description": "Знаходьте вигоду між покупкою сета окремо та продажем його в зібраному вигляді.",
|
||||||
|
"filter_by_difference": "Фільтрувати за різницею:",
|
||||||
|
"name": "Назва",
|
||||||
|
"parts_price": "Вартість частин",
|
||||||
|
"set_price": "Вартість сета",
|
||||||
|
"difference": "Різниця",
|
||||||
|
"generated_at": "Згенеровано в"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const Handlebars = require('handlebars')
|
const Handlebars = require('handlebars')
|
||||||
|
const { ifEq } = require('./helpers')
|
||||||
const ListingSet = require('./ListingSet')
|
const ListingSet = require('./ListingSet')
|
||||||
const i18n = require('./i18n.json')
|
const i18n = require('./i18n.json')
|
||||||
|
|
||||||
|
Handlebars.registerHelper('if_eq', ifEq)
|
||||||
|
|
||||||
class Output {
|
class Output {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.items = []
|
this.items = []
|
||||||
@@ -32,11 +35,11 @@ class Output {
|
|||||||
const template = await this._compileTemplate()
|
const template = await this._compileTemplate()
|
||||||
|
|
||||||
Object.keys(i18n).forEach(locale => {
|
Object.keys(i18n).forEach(locale => {
|
||||||
const filename = locale === 'en' ? 'index' : locale
|
const filename = i18n[locale].link
|
||||||
this._writeToFile(`./public/${filename}.html`, template({
|
this._writeToFile(`./public/${filename}.html`, template({
|
||||||
...this,
|
...this,
|
||||||
t: i18n[locale],
|
t: i18n[locale],
|
||||||
languages: Object.keys(i18n).filter(language => language !== locale)
|
languages: i18n
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,11 @@
|
|||||||
|
|
||||||
<div class="languages">
|
<div class="languages">
|
||||||
{{#each languages}}
|
{{#each languages}}
|
||||||
<a href="/{{this}}">
|
<a
|
||||||
<img src="./assets/languages/{{this}}.png">
|
href="/{{this.link}}"
|
||||||
|
class="{{#if_eq ../t.link this.link}}selected{{/if_eq}}"
|
||||||
|
>
|
||||||
|
<img src="./assets/languages/{{@key}}.png">
|
||||||
</a>
|
</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user