Skip to content

Commit

Permalink
Dependency updates. Implemented TRANSLATION_DEFAULT to override defau…
Browse files Browse the repository at this point in the history
…lt selected translation
  • Loading branch information
glenndehaan committed Jan 4, 2025
1 parent f717a2e commit 5e6ddc7
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 534 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ services:
SMTP_PASSWORD: ''
# Sets the application Log Level (Valid Options: error|warn|info|debug|trace)
LOG_LEVEL: 'info'
# Sets the default translation for dropdowns
TRANSLATION_DEFAULT: 'en'
# Enables/disables translation debugging, when enabled only translation keys are shown
TRANSLATION_DEBUG: 'false'
```
Expand Down
8 changes: 8 additions & 0 deletions modules/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const array = require('../utils/array');
const logo = require('../utils/logo');
const types = require('../utils/types');
const time = require('../utils/time');
const languages = require('../utils/languages');

/**
* Output info to console
Expand Down Expand Up @@ -50,6 +51,13 @@ module.exports = () => {
log.info(`[Options] Found at ${process.cwd()}/.options.json`);
}

/**
* Check for incorrect translation default
*/
if(!Object.keys(languages).includes(variables.translationDefault)) {
log.error(`[Translations] Default language: '${variables.translationDefault}' doesn't exist!`);
}

/**
* Log service status
*/
Expand Down
1 change: 1 addition & 0 deletions modules/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
smtpUsername: config('smtp_username') || process.env.SMTP_USERNAME || '',
smtpPassword: config('smtp_password') || process.env.SMTP_PASSWORD || '',
logLevel: config('log_level') || process.env.LOG_LEVEL || 'info',
translationDefault: config('translation_default') || process.env.TRANSLATION_DEFAULT || 'en',
translationDebug: config('translation_debug') || (process.env.TRANSLATION_DEBUG === 'true') || false,
gitTag: process.env.GIT_TAG || 'master',
gitBuild: fs.existsSync('/etc/unifi_voucher_site_build') ? fs.readFileSync('/etc/unifi_voucher_site_build', 'utf-8') : 'Development'
Expand Down
Loading

0 comments on commit 5e6ddc7

Please sign in to comment.