#102 components i18n new approach changes

This commit is contained in:
Agriya Dev5
2021-05-22 11:37:56 +05:30
parent b364daf193
commit 61957b7d4e
2 changed files with 15 additions and 3 deletions

View File

@@ -1,5 +1,4 @@
/* eslint-disable max-len */ /* eslint-disable max-len */
/* gl#bals svgEditor */
import { jGraduate, jGraduateMethod } from './jgraduate/jQuery.jGraduate.js'; import { jGraduate, jGraduateMethod } from './jgraduate/jQuery.jGraduate.js';
import PaintBox from './PaintBox.js'; import PaintBox from './PaintBox.js';
@@ -643,7 +642,7 @@ div.jGraduate_Slider img {
</style> </style>
<div id="picker"> <div id="picker">
<img src="./images/logo.svg" alt="icon" id="logo"> <img src="./images/logo.svg" alt="icon" id="logo">
<label for="color" title="#svgEditor.i18next.t('config.change_xxx_color')}" id="label"></label> <label for="color" title="" id="label"></label>
<div id="block"> <div id="block">
</div> </div>
</div> </div>
@@ -669,12 +668,20 @@ export class SeColorPicker extends HTMLElement {
this.$picker = this._shadowRoot.getElementById('picker'); this.$picker = this._shadowRoot.getElementById('picker');
this.$color_picker = this._shadowRoot.getElementById('color_picker'); this.$color_picker = this._shadowRoot.getElementById('color_picker');
} }
/**
* @function init
* @param {any} name
* @returns {void}
*/
init (i18next) {
this.setAttribute('config-change_xxx_color', i18next.t('config.change_xxx_color'));
}
/** /**
* @function observedAttributes * @function observedAttributes
* @returns {any} observed * @returns {any} observed
*/ */
static get observedAttributes () { static get observedAttributes () {
return [ 'label', 'src', 'type' ]; return [ 'label', 'src', 'type', 'config-change_xxx_color' ];
} }
/** /**
* @function attributeChangedCallback * @function attributeChangedCallback
@@ -695,6 +702,9 @@ export class SeColorPicker extends HTMLElement {
case 'type': case 'type':
this.$label.setAttribute('title', 'config.pick_paint_opavity'); this.$label.setAttribute('title', 'config.pick_paint_opavity');
break; break;
case 'config-change_xxx_color':
this.$label.setAttribute('title', newValue);
break;
default: default:
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(`unknown attribute: ${name}`); console.error(`unknown attribute: ${name}`);

View File

@@ -227,6 +227,8 @@ class BottomPanel {
$id('stroke_linejoin').addEventListener('change', (evt) => this.handleStrokeAttr.bind(this)('stroke-linejoin', evt)); $id('stroke_linejoin').addEventListener('change', (evt) => this.handleStrokeAttr.bind(this)('stroke-linejoin', evt));
$id('stroke_linecap').addEventListener('change', (evt) => this.handleStrokeAttr.bind(this)('stroke-linecap', evt)); $id('stroke_linecap').addEventListener('change', (evt) => this.handleStrokeAttr.bind(this)('stroke-linecap', evt));
$id('opacity').addEventListener('change', this.handleOpacity.bind(this)); $id('opacity').addEventListener('change', this.handleOpacity.bind(this));
$id('fill_color').init(i18next);
$id('stroke_color').init(i18next);
} }
/** /**
* @type {module} * @type {module}