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;
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin: 10px;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.languages > a {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin: 10px;
|
||||
padding: 10px;
|
||||
display: inline-block;
|
||||
padding: 5px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.languages img {
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.languages .selected {
|
||||
background: rgb(233, 233, 233);
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 50%);
|
||||
}
|
||||
|
||||
.controls {
|
||||
margin: 32px auto;
|
||||
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": {
|
||||
"link": "index",
|
||||
"title": "Market Gaps",
|
||||
"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:",
|
||||
@@ -10,6 +11,7 @@
|
||||
"generated_at": "Generated at"
|
||||
},
|
||||
"ru": {
|
||||
"link": "ru",
|
||||
"title": "Market Gaps",
|
||||
"description": "Находите выгоду между покупкой сета по отдельности и продажей его в собранном виде.",
|
||||
"filter_by_difference": "Фильтровать по разнице:",
|
||||
@@ -18,5 +20,16 @@
|
||||
"set_price": "Стоимость сета",
|
||||
"difference": "Разница",
|
||||
"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 Handlebars = require('handlebars')
|
||||
const { ifEq } = require('./helpers')
|
||||
const ListingSet = require('./ListingSet')
|
||||
const i18n = require('./i18n.json')
|
||||
|
||||
Handlebars.registerHelper('if_eq', ifEq)
|
||||
|
||||
class Output {
|
||||
constructor () {
|
||||
this.items = []
|
||||
@@ -32,11 +35,11 @@ class Output {
|
||||
const template = await this._compileTemplate()
|
||||
|
||||
Object.keys(i18n).forEach(locale => {
|
||||
const filename = locale === 'en' ? 'index' : locale
|
||||
const filename = i18n[locale].link
|
||||
this._writeToFile(`./public/${filename}.html`, template({
|
||||
...this,
|
||||
t: i18n[locale],
|
||||
languages: Object.keys(i18n).filter(language => language !== locale)
|
||||
languages: i18n
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,8 +36,11 @@
|
||||
|
||||
<div class="languages">
|
||||
{{#each languages}}
|
||||
<a href="/{{this}}">
|
||||
<img src="./assets/languages/{{this}}.png">
|
||||
<a
|
||||
href="/{{this.link}}"
|
||||
class="{{#if_eq ../t.link this.link}}selected{{/if_eq}}"
|
||||
>
|
||||
<img src="./assets/languages/{{@key}}.png">
|
||||
</a>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user