Skip to content

Commit

Permalink
Merge pull request #1198 from Yelinz/locale-fix
Browse files Browse the repository at this point in the history
fix(ember): fix shown locales
  • Loading branch information
open-dynaMIX authored Jan 24, 2025
2 parents 6e2a31c + cc4ccc9 commit 8de4c2e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
5 changes: 5 additions & 0 deletions ember/app/ui/components/nav-bar/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { timeout, restartableTask } from "ember-concurrency";
import { task as trackedTask } from "reactiveweb/ember-concurrency";

import ENV from "mysagw/config/environment";

export default class NavbarComponent extends Component {
@service session;
@service intl;
Expand All @@ -18,6 +21,8 @@ export default class NavbarComponent extends Component {
@tracked totalPages;
@tracked snippets = [];

locales = ENV.APP.locales;

@action
invalidateSession() {
this.session.singleLogout();
Expand Down
21 changes: 13 additions & 8 deletions ember/app/ui/components/nav-bar/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@
<UkIcon @icon="chevron-down" />
</a>
<ul
uk-dropdown="pos: bottom-justify"
uk-dropdown="offset: -30"
class="uk-list uk-list-collapse uk-padding-small uk-text-center uk-margin-remove"
>
{{#each this.intl.locales as |locale|}}
<li>
{{#each this.locales as |locale|}}
<li class="uk-margin-small">
<a
class="uk-link-text uk-text-uppercase"
class="uk-link-text uk-text-uppercase {{if (eq this.intl.primaryLocale locale) 'uk-text-primary'}}"
{{on "click" (fn this.setLocale locale)}}
href="#"
>
Expand Down Expand Up @@ -246,6 +246,11 @@
{{t "components.nav-bar.form-configuration"}}
</LinkTo>
</li>
<li>
<LinkTo @route="analytics">
{{t "components.nav-bar.analytics"}}
</LinkTo>
</li>
{{/if}}

<li class="uk-nav-header">{{t "components.nav-bar.account"}}</li>
Expand Down Expand Up @@ -275,14 +280,14 @@
<UkIcon @icon="chevron-down" />
</a>
<ul
uk-dropdown="pos: bottom-center; mode: click"
class="uk-list uk-list-collapse uk-padding-small"
uk-dropdown="pos: bottom-center; mode: click;"
class="uk-list uk-list-collapse uk-padding-small uk-width-1-2"
data-test-locale-dropdown
>
{{#each this.intl.locales as |locale|}}
{{#each this.locales as |locale|}}
<li>
<a
class="uk-link-text uk-text-uppercase"
class="uk-link-text uk-text-uppercase {{if (eq this.intl.primaryLocale locale) 'uk-text-primary'}}"
{{on "click" (fn this.setLocale locale)}}
href="#"
data-test-locale-select={{locale}}
Expand Down
2 changes: 1 addition & 1 deletion ember/config/ember-intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = function (/* environment */) {
* @type {String?}
* @default "null"
*/
fallbackLocale: "en",
fallbackLocale: "de",

/**
* Path where translations are stored. This is relative to the project root.
Expand Down
4 changes: 2 additions & 2 deletions ember/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ module.exports = function (environment) {
},

APP: {
// Here you can pass flags/options to your application document
// when it is created
navBarLogo: "/assets/logo-header.svg",
navBarText: "mySAGW",

Expand All @@ -72,6 +70,8 @@ module.exports = function (environment) {
complete: "check",
},

locales: ["de", "fr", "en"],

caluma: {
submitTaskSlug: "submit-document",
reviseTaskSlug: "revise-document",
Expand Down

0 comments on commit 8de4c2e

Please sign in to comment.