Skip to content

Commit

Permalink
Add German Localization (#1998)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickscheips authored Jan 5, 2024
1 parent e12ab6b commit 396efc7
Show file tree
Hide file tree
Showing 12 changed files with 3,036 additions and 7 deletions.
9 changes: 5 additions & 4 deletions front/src/components/boxs/chart/ApexChartComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ApexCharts from 'apexcharts';

import fr from 'apexcharts/dist/locales/fr.json';
import en from 'apexcharts/dist/locales/en.json';
import de from 'apexcharts/dist/locales/de.json';

import dayjs from 'dayjs';
import localizedFormat from 'dayjs/plugin/localizedFormat';
Expand Down Expand Up @@ -43,7 +44,7 @@ class ApexChartComponent extends Component {
displayAxes: this.props.display_axes,
series: this.props.series,
COLORS,
locales: [fr, en],
locales: [fr, en, de],
defaultLocale: this.props.user.language
});
this.addDateFormatter(options);
Expand All @@ -63,7 +64,7 @@ class ApexChartComponent extends Component {
series: this.props.series,
displayAxes: this.props.display_axes,
COLORS,
locales: [fr, en],
locales: [fr, en, de],
defaultLocale: this.props.user.language
});
this.addDateFormatter(options);
Expand All @@ -84,7 +85,7 @@ class ApexChartComponent extends Component {
COLORS,
displayAxes: this.props.display_axes,
series: this.props.series,
locales: [fr, en],
locales: [fr, en, de],
defaultLocale: this.props.user.language
});
this.addDateFormatter(options);
Expand All @@ -104,7 +105,7 @@ class ApexChartComponent extends Component {
COLORS,
displayAxes: this.props.display_axes,
series: this.props.series,
locales: [fr, en],
locales: [fr, en, de],
defaultLocale: this.props.user.language
});
this.addDateFormatter(options);
Expand Down
3 changes: 3 additions & 0 deletions front/src/components/user/profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ const Profile = ({ children, ...props }) => {
<option value="fr">
<Text id="profile.french" />
</option>
<option value="de">
<Text id="profile.german" />
</option>
</select>
</div>
{!props.disableRole && (
Expand Down
3,014 changes: 3,014 additions & 0 deletions front/src/config/i18n/de.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions front/src/config/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"languageLabel": "Language",
"english": "English",
"french": "Français",
"german": "Deutsch",
"birthdateLabel": "Birthdate",
"birthdatePlaceHolder": "Enter your birthdate",
"january": "January",
Expand Down Expand Up @@ -1918,6 +1919,7 @@
"languageLabel": "Language",
"english": "English",
"french": "Français",
"german": "Deutsch",
"roleLabel": "Role",
"passwordLabel": "Password (min 8 characters)",
"passwordPlaceholder": "Enter your password",
Expand Down
2 changes: 2 additions & 0 deletions front/src/config/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"languageLabel": "Langue",
"english": "English",
"french": "Français",
"german": "Deutsch",
"birthdateLabel": "Date de naissance",
"birthdatePlaceHolder": "Entrez votre date de naissance",
"january": "Janvier",
Expand Down Expand Up @@ -1920,6 +1921,7 @@
"languageLabel": "Langue",
"english": "English",
"french": "Français",
"german": "Deutsch",
"roleLabel": "Rôle",
"passwordLabel": "Mot de passe (min 8 caractères)",
"passwordPlaceholder": "Entrez votre mot de passe",
Expand Down
3 changes: 2 additions & 1 deletion front/src/config/i18n/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import en from './en.json';
import fr from './fr.json';
import de from './de.json';
import { AVAILABLE_LANGUAGES } from '../../../../server/utils/constants';

export default { [AVAILABLE_LANGUAGES.FR]: fr, [AVAILABLE_LANGUAGES.EN]: en };
export default { [AVAILABLE_LANGUAGES.FR]: fr, [AVAILABLE_LANGUAGES.EN]: en, [AVAILABLE_LANGUAGES.DE]: de };
1 change: 1 addition & 0 deletions front/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import '@gladysassistant/theme-optimized/dashboard.css';
import 'dayjs/locale/en';
import 'dayjs/locale/fr';
import 'dayjs/locale/de';
import './style';
import App from './components/app';

Expand Down
3 changes: 2 additions & 1 deletion front/src/routes/signup/2-create-account-local/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import CreateAccountLocalTab from './CreateAccountLocalTab';
import validateEmail from '../../../utils/validateEmail';
import { RequestStatus, CreateUserErrors } from '../../../utils/consts';
import actions from '../../../actions/signup/signupCreateLocalAccount';
import { getDefaultState } from '../../../utils/getDefaultState';

const MIN_PASSWORD_LENGTH = 8;

Expand All @@ -21,7 +22,7 @@ class CreateAccountLocal extends Component {
// there is no way to ALTER a column in SQlite, so we set a default value
// here to simplify the login process
birthdate: new Date(2000, 0, 1),
language: navigator.language === 'fr' ? 'fr' : 'en',
language: getDefaultState().user.language,
password: '',
passwordRepeat: ''
}
Expand Down
2 changes: 1 addition & 1 deletion server/api/controllers/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function UserController(gladys) {
* @apiParam {String} password Password of the user
* @apiParam {string="admin","habitant", "guest"} role role of the user
* @apiParam {date} birthdate Birthdate of the user
* @apiParam {string="en", "fr"} language Language of the user
* @apiParam {string="en", "fr", "de"} language Language of the user
* @apiSuccess {String} id id of the created user
*/
async function create(req, res, next) {
Expand Down
1 change: 1 addition & 0 deletions server/lib/scene/scene.checkCalendarTriggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const dayjs = require('dayjs');

require('dayjs/locale/en');
require('dayjs/locale/fr');
require('dayjs/locale/de');

const LocalizedFormat = require('dayjs/plugin/localizedFormat');
const db = require('../../models');
Expand Down
2 changes: 2 additions & 0 deletions server/test/lib/scene/scene.checkCalendarTriggers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const dayjs = require('dayjs');

require('dayjs/locale/en');
require('dayjs/locale/fr');
require('dayjs/locale/de');

const LocalizedFormat = require('dayjs/plugin/localizedFormat');

const EventEmitter = require('events');
Expand Down
1 change: 1 addition & 0 deletions server/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const USER_ROLE = {
const AVAILABLE_LANGUAGES = {
EN: 'en',
FR: 'fr',
DE: 'de',
};

const SESSION_TOKEN_TYPES = {
Expand Down

0 comments on commit 396efc7

Please sign in to comment.