Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
khanh1902 committed Jun 29, 2024
1 parent d98f700 commit e7436c3
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions utils/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ module.exports = class Cards {

subtitle =
this.currentLanguage !== this.defaultLanguage
? await translate(subtitle, this.currentLanguage, this.defaultLanguage)
? await translate(
subtitle,
this.currentLanguage,
this.defaultLanguage
)
: subtitle;

const card = {
Expand Down Expand Up @@ -132,10 +136,12 @@ module.exports = class Cards {

if (!value || !type || !label) throw new Error('Missing parameter');

const translateLabel =
let translateLabel =
this.currentLanguage !== this.defaultLanguage
? await translate(label, this.currentLanguage, this.defaultLanguage).slice(0, 20)
: label.slice(0, 20);
? await translate(label, this.currentLanguage, this.defaultLanguage)
: label;

translateLabel = translateLabel.slice(0, 20);

switch (type) {
case 'url':
Expand Down Expand Up @@ -176,7 +182,11 @@ module.exports = class Cards {

subtitle =
this.currentLanguage !== this.defaultLanguage
? await translate(subtitle, this.currentLanguage, this.defaultLanguage)
? await translate(
subtitle,
this.currentLanguage,
this.defaultLanguage
)
: subtitle;

const card = {
Expand Down Expand Up @@ -206,10 +216,12 @@ module.exports = class Cards {

if (!value || !type || !label) throw new Error('Missing parameter');

const translateLabel =
let translateLabel =
this.currentLanguage !== this.defaultLanguage
? await translate(label, this.currentLanguage, this.defaultLanguage).slice(0, 20)
: label.slice(0, 20);
? await translate(label, this.currentLanguage, this.defaultLanguage)
: label;

translateLabel = translateLabel.slice(0, 20);

switch (type) {
case 'url':
Expand Down

0 comments on commit e7436c3

Please sign in to comment.