Skip to content
Snippets Groups Projects
Commit 7559a8b4 authored by Kocher, Manuel's avatar Kocher, Manuel
Browse files

Remove local translation overrides since it became redundant, update translation.json files

parent dc3c70ea
No related branches found
No related tags found
No related merge requests found
Pipeline #188541 failed
......@@ -10,7 +10,6 @@ export class Translation extends DBPLitElement {
this.key = '';
this.lang = '';
this.interpolation = '';
this.langDir = '';
this.unsafe = false;
}
......@@ -21,47 +20,32 @@ export class Translation extends DBPLitElement {
lang: {type: String},
interpolation: {type: Object, attribute: 'var'},
unsafe: {type: Boolean, attribute: 'unsafe'},
langDir: {type: String, attribute: 'lang-dir'},
};
}
static get styles() {
// language=css
return [
commonStyles.getThemeCSS(),
commonStyles.getGeneralCSS(),
css`
.hidden {
display: none;
}
.links {
border-bottom: var(--dbp-border);
border-color: var(--dbp-content);
padding: 0;
transition: background-color 0.15s ease 0s, color 0.15s ease 0s;
color: var(--dbp-content);
cursor: pointer;
text-decoration: none;
}
`,
commonStyles.getLinkCss(),
];
}
connectedCallback() {
super.connectedCallback();
// init objects with empty string as value for key
const de = {};
const en = {};
de[this.key] = "";
en[this.key] = "";
// create i18n instance with given translations
// create i18n instance with empty translations as default
this._i18n = createInstanceGivenResources(en, de);
if (this.langDir) {
setOverridesByGlobalCache(this._i18n, this);
}
// supercall after default i18n init to override translations only
// if a override with this tagname is given
super.connectedCallback();
}
update(changedProperties) {
......
import {createInstance, setOverridesByGlobalCache} from './i18n.js';
import {createInstance} from './i18n.js';
import {html, css} from 'lit';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {AdapterLitElement, Icon} from '@dbp-toolkit/common';
......@@ -15,7 +15,6 @@ export class ThemeSwitcher extends ScopedElementsMixin(AdapterLitElement) {
this.boundCloseAdditionalMenuHandler = this.hideModeMenu.bind(this);
this.detectBrowserDarkMode = false;
this.darkModeClass = 'dark-theme';
this.langDir = '';
this.dropdownRight = false;
}
......@@ -26,7 +25,6 @@ export class ThemeSwitcher extends ScopedElementsMixin(AdapterLitElement) {
themes: {type: Array, attribute: 'themes'},
darkModeThemeOverride: {type: String, attribute: 'dark-mode-theme-override'},
dropdownRight: {type: Boolean, attribute: 'dropdown-right'},
langDir: {type: String, attribute: 'lang-dir'},
};
}
......@@ -59,9 +57,6 @@ export class ThemeSwitcher extends ScopedElementsMixin(AdapterLitElement) {
this.loadTheme('light-theme');
this.detectInitialMode();
});
if (this.langDir) {
setOverridesByGlobalCache(this._i18n, this);
}
}
detectInitialMode() {
......@@ -225,12 +220,12 @@ export class ThemeSwitcher extends ScopedElementsMixin(AdapterLitElement) {
.icon {
margin-right: 10px;
}
#theme-menu{
position: relative;
}
.ul-right{
right: 0px;
};
......
{
"dbp-translation": {
"toolkit-showcase": "Dieser Text wird mithilfe von i18n aus einer benutzerdefinierten Sprachdatei gelesen und ins Englische übersetzt wenn man die Sprache auf Englisch stellt.",
"toolkit-showcase-link": "Es können sogar links mittels <a href=\"{{- link1}}\" class=\"links\">interpolation</a> und escaping dargestellt werden.",
"toolkit-showcase-link": "Es können sogar links mittels <a href=\"{{- link1}}\" class=\"link\">interpolation</a> und escaping dargestellt werden.",
"color-mode": "Sollte nicht angezeigt werden. Dieser Text ist nur als test vorhanden.",
"intro": "Sollte nicht angezeigt werden. Dieser Text ist nur als test vorhanden."
},
......
{
"dbp-translation": {
"toolkit-showcase": "This text will be translated to german using i18n with a user defined language file when the language is changed to german.",
"toolkit-showcase-link": "Furthermore its possible to display links through <a href=\"{{- link1}}\" class=\"links\">interpolation</a> and escaping.",
"toolkit-showcase-link": "Furthermore its possible to display links through <a href=\"{{- link1}}\" class=\"link\">interpolation</a> and escaping.",
"color-mode": "This text is not supposed to be displayed. It is only here for testing.",
"intro": "This text is not supposed to be displayed. It is only here for testing."
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment