Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit a4052a0

Browse files
author
Philipp Etschel
authored
Merge pull request #681 from bosch-io/feature/language-support
Full language support
2 parents 89eebe5 + b564e62 commit a4052a0

File tree

100 files changed

+2882
-1414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2882
-1414
lines changed

frontend/.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Copyright (c) 2020-2021 - for information on the respective copyright owner
2+
# see the NOTICE file and/or the repository at
3+
# https://github.com/hyperledger-labs/business-partner-agent
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
16
node_modules
27
dist
38

frontend/.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Copyright (c) 2020-2021 - for information on the respective copyright owner
2+
# see the NOTICE file and/or the repository at
3+
# https://github.com/hyperledger-labs/business-partner-agent
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
17
VUE_APP_TITLE=Business Partner Agent
28
VUE_APP_API_BASE_URL=/api
39
#VUE_APP_EVENTS_HOST=localhost:8000

frontend/.eslintrc.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2020-2021 - for information on the respective copyright owner
3+
* see the NOTICE file and/or the repository at
4+
* https://github.com/hyperledger-labs/business-partner-agent
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
18
module.exports = {
29
root: true,
310
env: {
@@ -10,5 +17,8 @@ module.exports = {
1017
rules: {
1118
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
1219
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
20+
"vue/multi-word-component-names": "off",
21+
"vue/no-mutating-props": "warn",
22+
"vue/valid-v-slot": "warn",
1323
},
14-
};
24+
};

frontend/babel.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2020-2021 - for information on the respective copyright owner
3+
* see the NOTICE file and/or the repository at
4+
* https://github.com/hyperledger-labs/business-partner-agent
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
18
module.exports = {
29
presets: ["@vue/cli-plugin-babel/preset"],
310
};

frontend/jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2020-2021 - for information on the respective copyright owner
3+
* see the NOTICE file and/or the repository at
4+
* https://github.com/hyperledger-labs/business-partner-agent
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
18
module.exports = {
29
preset: "@vue/cli-plugin-unit-jest",
310
verbose: true,

frontend/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
2-
"name": "company-agent-frontend",
2+
"name": "business-partner-agent-frontend",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"test:unit": "vue-cli-service test:unit",
88
"build": "vue-cli-service build",
9-
"lint": "vue-cli-service lint",
10-
"license-check": "license-checker --production --json --onlyAllow 'MIT;Python-2.0;Apache-2.0;BSD-2-Clause;BSD-3-Clause' --excludePackages 'company-agent-frontend@0.1.0'",
9+
"lint": "vue-cli-service lint && npm run license-file-headers-add",
10+
"license-file-headers-add": "license-check-and-add add -f licenses/config.json -r 2021",
11+
"license-check": "license-checker --production --json --onlyAllow 'MIT;Python-2.0;Apache-2.0;BSD-2-Clause;BSD-3-Clause' --excludePackages 'business-partner-agent-frontend@0.1.0'",
1112
"license": "generate-attribution -o ./licenses",
1213
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
1314
},
@@ -44,10 +45,11 @@
4445
"@vue/eslint-config-prettier": "^6.0.0",
4546
"@vue/test-utils": "^1.1.1",
4647
"babel-eslint": "^10.1.0",
47-
"eslint": "^6.7.2",
48+
"eslint": "^6.8.0",
4849
"eslint-plugin-prettier": "^3.1.4",
49-
"eslint-plugin-vue": "^6.2.2",
50+
"eslint-plugin-vue": "^8.1.0",
5051
"husky": "^4.3.0",
52+
"license-check-and-add": "^4.0.3",
5153
"license-checker": "25.0.1",
5254
"lint-staged": "^10.4.2",
5355
"node-sass": "^5.0.0",
@@ -68,6 +70,7 @@
6870
}
6971
},
7072
"lint-staged": {
71-
"**/*.{js,vue}": "prettier --write"
73+
"**/*.{html,xml,ts,css,scss,env,dockerignore,sh}": "license-check-and-add add -f licenses/config.json -r 2021",
74+
"**/*.{js,vue}": ["license-check-and-add add -f licenses/config.json -r 2021", "prettier --write"]
7275
}
7376
}

frontend/public/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<!--
2+
Copyright (c) 2020-2021 - for information on the respective copyright owner
3+
see the NOTICE file and/or the repository at
4+
https://github.com/hyperledger-labs/business-partner-agent
5+
6+
SPDX-License-Identifier: Apache-2.0
7+
-->
18
<!DOCTYPE html>
29
<html lang="en">
310
<head>

frontend/src/App.vue

Lines changed: 62 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
2-
Copyright (c) 2020 - for information on the respective copyright owner
2+
Copyright (c) 2020-2021 - for information on the respective copyright owner
33
see the NOTICE file and/or the repository at
4-
https://github.com/hyperledger-labs/organizational-agent
4+
https://github.com/hyperledger-labs/business-partner-agent
55
66
SPDX-License-Identifier: Apache-2.0
77
-->
@@ -17,28 +17,32 @@
1717
>
1818
<v-list-item-content>
1919
<v-list-item-title v-if="ux.navigation.avatar.agent.default">
20-
<v-img v-if="logo"
21-
contain
22-
max-height="100"
23-
max-width="228"
24-
:src="logo"
20+
<v-img
21+
v-if="logo"
22+
contain
23+
max-height="100"
24+
max-width="228"
25+
:src="logo"
2526
></v-img>
26-
<v-img v-else
27-
contain
28-
max-height="100"
29-
max-width="228"
30-
src="@/assets/logo_default.svg"
27+
<v-img
28+
v-else
29+
contain
30+
max-height="100"
31+
max-width="228"
32+
src="@/assets/logo_default.svg"
3133
></v-img>
3234
</v-list-item-title>
3335
<v-list-item-title v-else>
3436
<v-img
35-
contain
36-
max-height="100"
37-
max-width="228"
38-
:src="ux.navigation.avatar.agent.src"
37+
contain
38+
max-height="100"
39+
max-width="228"
40+
:src="ux.navigation.avatar.agent.src"
3941
></v-img
40-
></v-list-item-title>
41-
<v-list-item-subtitle class="mt-2 text-wrap nav-display-name">{{ getNavDisplayName }}</v-list-item-subtitle>
42+
></v-list-item-title>
43+
<v-list-item-subtitle class="mt-2 text-wrap nav-display-name">{{
44+
getNavDisplayName
45+
}}</v-list-item-subtitle>
4246
</v-list-item-content>
4347
</v-list-item>
4448
</router-link>
@@ -140,10 +144,10 @@
140144
<template v-slot:append>
141145
<v-list dense>
142146
<v-list-item
143-
v-if="ux.navigation.settings.location === 'bottom'"
144-
bottom
145-
link
146-
:to="{ name: 'Settings' }"
147+
v-if="ux.navigation.settings.location === 'bottom'"
148+
bottom
149+
link
150+
:to="{ name: 'Settings' }"
147151
>
148152
<v-list-item-action>
149153
<v-icon>$vuetify.icons.settings</v-icon>
@@ -182,14 +186,15 @@
182186
</v-navigation-drawer>
183187

184188
<v-app-bar color="primary" app flat dark>
185-
<v-badge v-if="!drawer"
186-
overlap
187-
bordered
188-
:content="notificationsCount"
189-
:value="notificationsCount"
190-
color="red"
191-
offset-x="53"
192-
offset-y="53"
189+
<v-badge
190+
v-if="!drawer"
191+
overlap
192+
bordered
193+
:content="notificationsCount"
194+
:value="notificationsCount"
195+
color="red"
196+
offset-x="53"
197+
offset-y="53"
193198
>
194199
<v-app-bar-nav-icon @click.stop="drawer = !drawer" />
195200
</v-badge>
@@ -298,7 +303,8 @@
298303
import { EventBus } from "./main";
299304
import Taa from "./components/taa/TransactionAuthorAgreement";
300305
import BasicMessages from "@/components/messages/BasicMessages";
301-
import merge from 'deepmerge';
306+
import merge from "deepmerge";
307+
import i18n from "@/plugins/i18n";
302308
303309
export default {
304310
components: {
@@ -333,7 +339,7 @@ export default {
333339
agent: {
334340
enabled: true,
335341
default: true,
336-
'show-name': true
342+
"show-name": true,
337343
},
338344
},
339345
about: {
@@ -379,10 +385,13 @@ export default {
379385
return this.$store.getters.messagesCount;
380386
},
381387
notificationsCount() {
382-
return this.$store.getters.taskNotificationsCount + this.$store.getters.activityNotificationsCount;
388+
return (
389+
this.$store.getters.taskNotificationsCount +
390+
this.$store.getters.activityNotificationsCount
391+
);
383392
},
384393
getAgentName() {
385-
let bpaName = "Business Partner Agent";
394+
let bpaName = this.$t("app.bpaDefaultName");
386395
const nameSettingValue = this.$store.getters.getSettingByKey("agentName");
387396
if (nameSettingValue) {
388397
bpaName = nameSettingValue;
@@ -397,7 +406,7 @@ export default {
397406
return "";
398407
},
399408
getNavDisplayName() {
400-
if (this.ux.navigation.avatar.agent['show-name']) {
409+
if (this.ux.navigation.avatar.agent["show-name"]) {
401410
const result = this.getOrganizationName;
402411
return result ? result : this.getAgentName;
403412
}
@@ -418,18 +427,34 @@ export default {
418427
this.$vuetify.theme.dark = this.ux.theme.dark
419428
? this.ux.theme.dark
420429
: false;
421-
this.$vuetify.theme.themes.light = merge(this.$vuetify.theme.themes.light, this.ux.theme.themes.light);
430+
this.$vuetify.theme.themes.light = merge(
431+
this.$vuetify.theme.themes.light,
432+
this.ux.theme.themes.light
433+
);
422434
}
435+
423436
const uiColor = localStorage.getItem("uiColor");
437+
424438
if (uiColor) {
425439
// if the user stored an override of the primary color, load it.
426440
this.$vuetify.theme.themes.light.primary = uiColor;
427441
}
442+
428443
const uiColorIcons = localStorage.getItem("uiColorIcons");
444+
429445
if (uiColorIcons) {
430446
// if the user stored an override of the icons color, load it.
431447
this.$vuetify.theme.themes.light.icons = uiColorIcons;
432448
}
449+
450+
const locale =
451+
localStorage.getItem("locale") ||
452+
navigator.language.split("-")[0] ||
453+
process.env.VUE_APP_I18N_LOCALE ||
454+
"en";
455+
i18n.locale = locale;
456+
this.$vuetify.lang.current = locale;
457+
433458
// Load up an alternate favicon
434459
if (this.ux.favicon) {
435460
const favicon = document.getElementById("favicon");
@@ -487,7 +512,7 @@ export default {
487512
}
488513
// now, open or close it
489514
this.chatWindow = !this.chatWindow;
490-
}
515+
},
491516
},
492517
};
493518
</script>

frontend/src/assets/scss/style.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2020-2021 - for information on the respective copyright owner
3+
* see the NOTICE file and/or the repository at
4+
* https://github.com/hyperledger-labs/business-partner-agent
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
18
/*
29
* This globally extends the base Vuetify style
310
*/

0 commit comments

Comments
 (0)