Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ember): fix shown locales #1198

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading