Skip to content

Commit c34e58c

Browse files
committed
Merge branch 'beta'
2 parents cfffb13 + a43751c commit c34e58c

File tree

11 files changed

+1124
-1155
lines changed

11 files changed

+1124
-1155
lines changed

.github/workflows/nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- run: git config --global user.email '[email protected]'
2020
- run: npm ci
2121
- run: npm run github-workflow-next-version -- --cmd nightly
22+
- run: npm run pkg-upgrade
2223
- run: npm run release
2324
- run: npm run pre-commit
2425
- id: pkgjson

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ npm-debug.log
121121

122122
# App #
123123
#######
124+
.env
124125
/app/configs/config.js
125126
/app/configs/config.ts
126127
/app/configs/config.json

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
# v2.0.6 (January 16, 2022)
1+
# v2.0.2 (February 21, 2022)
22

3-
- Fix: CI/CD
3+
- Refactor: CI/CD now update the version of the package to the latest (nightly)
44

55
<!-- all-shields/sponsors-badges:START -->
66

77
[![Donate Paypal](https://img.shields.io/badge/donate-paypal-005EA6.svg?style=for-the-badge&logo=paypal)](https://www.paypal.me/ptkdev) [![Donate Ko-Fi](https://img.shields.io/badge/donate-ko--fi-29abe0.svg?style=for-the-badge&logo=ko-fi)](https://ko-fi.com/ptkdev) [![Donate Github Sponsors](https://img.shields.io/badge/donate-sponsors-ea4aaa.svg?style=for-the-badge&logo=github)](https://github.com/sponsors/ptkdev) [![Donate Patreon](https://img.shields.io/badge/donate-patreon-F87668.svg?style=for-the-badge&logo=patreon)](https://www.patreon.com/join/ptkdev) [![Donate Bitcoin](https://img.shields.io/badge/BTC-35jQmZCy4nsxoMM3QPFrnZePDVhdKaHMRH-E38B29.svg?style=flat-square&logo=bitcoin)](https://ptk.dev/img/icons/menu/bitcoin_wallet.png) [![Donate Ethereum](https://img.shields.io/badge/ETH-0x8b8171661bEb032828e82baBb0B5B98Ba8fBEBFc-4E8EE9.svg?style=flat-square&logo=ethereum)](https://ptk.dev/img/icons/menu/ethereum_wallet.png)
88

99
<!-- all-shields/sponsors-badges:END -->
1010

11+
# v2.0.1 (January 16, 2022)
12+
13+
- Fix: CI/CD
14+
1115
# v2.0.0 (January 16, 2022)
1216

1317
- Refactor: code quality, scripts and interfaces

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!-- all-shields/header-badges:START -->
44

5-
[![v2.0.1](https://img.shields.io/badge/version-v2.0.1-lightgray.svg?style=flat&logo=)](https://github.com/ptkdev-boilerplate/node-cli-boilerplate/blob/main/CHANGELOG.md) [![](https://img.shields.io/npm/v/@ptkdev/node-cli-boilerplate?color=CC3534&logo=npm)](https://www.npmjs.com/package/@ptkdev/node-cli-boilerplate) [![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat&logo=license)](https://github.com/ptkdev-boilerplate/node-cli-boilerplate/blob/main/LICENSE.md) [![Language: TypeScript](https://img.shields.io/badge/language-typescript-blue.svg?style=flat&logo=typescript)](https://www.typescriptlang.org/) [![ECMAScript: 2019](https://img.shields.io/badge/ES-9-F7DF1E.svg?style=flat&logo=javascript)](https://github.com/tc39/ecma262) [![Discord Server](https://discordapp.com/api/guilds/383373985666301975/embed.png)](https://discord.ptkdev.io)
5+
[![v2.0.2-beta.1](https://img.shields.io/badge/version-v2.0.2--beta.1-lightgray.svg?style=flat&logo=)](https://github.com/ptkdev-boilerplate/node-cli-boilerplate/blob/main/CHANGELOG.md) [![](https://img.shields.io/npm/v/@ptkdev/node-cli-boilerplate?color=CC3534&logo=npm)](https://www.npmjs.com/package/@ptkdev/node-cli-boilerplate) [![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat&logo=license)](https://github.com/ptkdev-boilerplate/node-cli-boilerplate/blob/main/LICENSE.md) [![Language: TypeScript](https://img.shields.io/badge/language-typescript-blue.svg?style=flat&logo=typescript)](https://www.typescriptlang.org/) [![ECMAScript: 2019](https://img.shields.io/badge/ES-9-F7DF1E.svg?style=flat&logo=javascript)](https://github.com/tc39/ecma262) [![Discord Server](https://discordapp.com/api/guilds/383373985666301975/embed.png)](https://discord.ptkdev.io)
66

77
<!-- all-shields/header-badges:END -->
88

@@ -85,7 +85,7 @@ Thanks to all our backers! 🙏 Donate 3$ or more on [paypal](https://www.paypal
8585

8686
## 👨‍💻 Contributing
8787

88-
I ❤️ contributions! I will happily accept your pull request! (**IMPORTANT**: Only nightly branch!) Translations, grammatical corrections (GrammarNazi you are welcome! Yes my English is bad, sorry), etc... Do not be afraid, if the code is not perfect we will work together 👯 and remember to insert your name in `.all-contributorsrc` and `package.json` file.
88+
I ❤️ contributions! I will happily accept your pull request! (**IMPORTANT**: Only to nightly branch!) Translations, grammatical corrections (GrammarNazi you are welcome! Yes my English is bad, sorry), etc... Do not be afraid, if the code is not perfect we will work together 👯 and remember to insert your name in `.all-contributorsrc` and `package.json` file.
8989

9090
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
9191

app/configs/config.js.tpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module.exports = {
22
server: {
33
// http://localhost:[PORT]
4-
port: process.env.PORT || 5000,
4+
port: 5000,
55
},
66

77
// Default language
8-
language: process.env.LANGUAGE || "en",
8+
language: "en",
99

1010
// Debug
11-
debug: process.env.DEBUG || true,
11+
debug: "disabled",
1212

1313
// LOGS
1414
// See: https://github.com/ptkdev/ptkdev-logger
@@ -19,12 +19,12 @@ module.exports = {
1919
},
2020
language: "en",
2121
colors: true,
22-
debug: process.env.LOGGER || "enabled",
23-
info: process.env.LOGGER || "enabled",
24-
warning: process.env.LOGGER || "enabled",
25-
error: process.env.LOGGER || "enabled",
26-
sponsor: process.env.LOGGER || "enabled",
27-
write: process.env.LOGGER_WRITE || false,
22+
debug: "enabled",
23+
info: "enabled",
24+
warning: "enabled",
25+
error: "enabled",
26+
sponsor: "enabled",
27+
write: false,
2828
type: "log",
2929
},
3030
};

app/routes/translations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-explicit-any */
21
/**
32
* Translations
43
* =====================
@@ -12,6 +11,7 @@
1211
import en from "@translations/en.json";
1312
import it from "@translations/it.json";
1413

14+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1515
const translations: any = {
1616
en,
1717
it,

app/translations/translate.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import type { TranslateParamsInterface } from "@app/types/translate.interfaces";
1414
/**
1515
* Replace Params
1616
* =====================
17-
* If translation text is: hi {{name}} how are you?
18-
* This function replace {{name}} token with correct value
17+
* If translation text is: hi {name} how are you?
18+
* This function replace {name} token with correct value
1919
*
2020
* @param {string} text - text of current phrase to translate (mandatory)
2121
* @param {Object} language_params - object with token to replace, example: {name:"alex"} (mandatory)
@@ -36,22 +36,26 @@ const replaceParams = (text: string, language_params: TranslateParamsInterface):
3636
* =====================
3737
* Check if exist translation in selected language, if not exist get string of phrase from "en" translation
3838
*
39+
* @param {string} lang - language from group/user (mandatory)
3940
* @param {string} language_id - key of translation phrase from /translations/*.json (mandatory)
4041
*
4142
* @return {string} text - text of available translation
4243
*
4344
*/
44-
const check = (language_id: string): string => {
45-
return translations[configs.language] && translations[configs.language][language_id]
46-
? translations[configs.language][language_id]
47-
: translations["en"][language_id];
45+
const check = (lang: string, language_id: string): string => {
46+
return (
47+
translations?.[lang]?.[language_id] ??
48+
translations?.["en"]?.[language_id] ??
49+
`translation id: ${language_id} in ${lang}.json is undefined`
50+
);
4851
};
4952

5053
/**
5154
* Translate
5255
* =====================
5356
* Get correct translation
5457
*
58+
* @param {string} lang - language from group/user (mandatory)
5559
* @param {string} language_id - key of translation phrase from /translations/*.json (mandatory)
5660
* @param {Object} language_params - object with token to replace, example: {name:"alex"} (optional)
5761
*
@@ -60,7 +64,8 @@ const check = (language_id: string): string => {
6064
*/
6165
const translate = (language_id: string, language_params?: TranslateParamsInterface): string => {
6266
let text = "";
63-
text = check(language_id);
67+
68+
text = check(configs.language, language_id);
6469
if (language_params) {
6570
text = replaceParams(text, language_params);
6671
}

0 commit comments

Comments
 (0)