Browse Source

Localize StyleManager

pull/2385/head
Artur Arseniev 7 years ago
parent
commit
7a25454571
  1. 2
      src/commands/view/OpenStyleManager.js
  2. 18
      src/i18n/locale/en.js
  3. 10
      src/i18n/locale/tr.js
  4. 6
      src/style_manager/config/config.js
  5. 5
      src/style_manager/view/LayerView.js
  6. 7
      src/style_manager/view/PropertyFileView.js
  7. 10
      src/style_manager/view/PropertyView.js
  8. 17
      src/style_manager/view/SectorView.js

2
src/commands/view/OpenStyleManager.js

@ -33,7 +33,7 @@ export default {
const pfx = smConfig.stylePrefix; const pfx = smConfig.stylePrefix;
// Create header // Create header
this.$header = $( this.$header = $(
`<div class="${pfx}header">${smConfig.textNoElement}</div>` `<div class="${pfx}header">${em.t('styleManager.empty')}</div>`
); );
this.$cn.append(this.$header); this.$cn.append(this.$header);

18
src/i18n/locale/en.js

@ -47,5 +47,23 @@ export default {
active: 'Click', active: 'Click',
'nth-of-type(2n)': 'Even/Odd' 'nth-of-type(2n)': 'Even/Odd'
} }
},
styleManager: {
empty: 'Select an element before using Style Manager',
layer: 'Layer',
fileButton: 'Images',
sectors: {
general: 'General',
layout: 'Layout',
typography: 'Typography',
decorations: 'Decorations',
extra: 'Extra',
flex: 'Flex',
dimension: 'Dimension'
},
// The core library generates the name by their `property` name
properties: {
// float: 'Float',
}
} }
}; };

10
src/i18n/locale/tr.js

@ -29,11 +29,12 @@ export default {
}, },
selectorManager: { selectorManager: {
selected: 'Seçili', selected: 'Seçili',
emptyState: '- DURUM -' emptyState: '- DURUM -',
label: 'Sınıflar'
}, },
styleManager: { styleManager: {
noEl: 'Stilini düzenlemek istediğiniz öğeyi seçiniz', empty: 'Stilini düzenlemek istediğiniz öğeyi seçiniz',
label: 'Sınıflar', layer: 'Katman',
sectors: { sectors: {
general: 'Genel', general: 'Genel',
layout: 'Düzen', layout: 'Düzen',
@ -125,8 +126,7 @@ export default {
'flex-grow': 'Flex Büyüme', 'flex-grow': 'Flex Büyüme',
'flex-shrink': 'Flex Küçülme', 'flex-shrink': 'Flex Küçülme',
'align-self': 'Kendini Hizala', 'align-self': 'Kendini Hizala',
'background-color': 'Arkaplan Rengi', 'background-color': 'Arkaplan Rengi'
assets: 'Görsel'
} }
}, },
traitManager: { traitManager: {

6
src/style_manager/config/config.js

@ -7,12 +7,6 @@ export default {
// With the empty value, nothing will be rendered // With the empty value, nothing will be rendered
appendTo: '', appendTo: '',
// Text to show in case no element selected
textNoElement: 'Select an element before using Style Manager',
// Text for layers
textLayer: 'Layer',
// Hide the property in case it's not stylable for the // Hide the property in case it's not stylable for the
// selected component (each component has 'stylable' property) // selected component (each component has 'stylable' property)
hideNotStylable: true, hideNotStylable: true,

5
src/style_manager/view/LayerView.js

@ -10,8 +10,8 @@ export default Backbone.View.extend({
}, },
template(model) { template(model) {
const { pfx, ppfx, config } = this; const { pfx, ppfx, em } = this;
const label = `${config.textLayer} ${model.get('index')}`; const label = `${em.t('styleManager.layer')} ${model.get('index')}`;
return ` return `
<div id="${pfx}move" class="${ppfx}no-touch-actions" data-move-layer> <div id="${pfx}move" class="${ppfx}no-touch-actions" data-move-layer>
@ -33,6 +33,7 @@ export default Backbone.View.extend({
let model = this.model; let model = this.model;
this.stackModel = o.stackModel || {}; this.stackModel = o.stackModel || {};
this.config = o.config || {}; this.config = o.config || {};
this.em = this.config.em;
this.pfx = this.config.stylePrefix || ''; this.pfx = this.config.stylePrefix || '';
this.ppfx = this.config.pStylePrefix || ''; this.ppfx = this.config.pStylePrefix || '';
this.sorter = o.sorter || null; this.sorter = o.sorter || null;

7
src/style_manager/view/PropertyFileView.js

@ -6,15 +6,14 @@ const $ = Backbone.$;
export default PropertyView.extend({ export default PropertyView.extend({
templateInput() { templateInput() {
const pfx = this.pfx; const { pfx, em } = this;
const ppfx = this.ppfx;
const assetsLabel = this.config.assetsLabel || 'Images';
return ` return `
<div class="${pfx}field ${pfx}file"> <div class="${pfx}field ${pfx}file">
<div id='${pfx}input-holder'> <div id='${pfx}input-holder'>
<div class="${pfx}btn-c"> <div class="${pfx}btn-c">
<button class="${pfx}btn" id="${pfx}images" type="button"> <button class="${pfx}btn" id="${pfx}images" type="button">
${assetsLabel} ${em.t('styleManager.fileButton')}
</button> </button>
</div> </div>
<div style="clear:both;"></div> <div style="clear:both;"></div>

10
src/style_manager/view/PropertyView.js

@ -19,14 +19,14 @@ export default Backbone.View.extend({
}, },
templateLabel(model) { templateLabel(model) {
const { pfx } = this; const { pfx, em } = this;
const icon = model.get('icon') || ''; const { parent } = model;
const info = model.get('info') || ''; const { icon = '', info = '', id, name } = model.attributes;
const parent = model.parent; const label = em.t(`styleManager.properties.${id}`) || name;
return ` return `
<span class="${pfx}icon ${icon}" title="${info}"> <span class="${pfx}icon ${icon}" title="${info}">
${model.get('name')} ${label}
</span> </span>
${!parent ? `<b class="${pfx}clear" ${clearProp}>&Cross;</b>` : ''} ${!parent ? `<b class="${pfx}clear" ${clearProp}>&Cross;</b>` : ''}
`; `;

17
src/style_manager/view/SectorView.js

@ -15,6 +15,7 @@ export default Backbone.View.extend({
initialize(o) { initialize(o) {
this.config = o.config || {}; this.config = o.config || {};
this.em = this.config.em;
this.pfx = this.config.stylePrefix || ''; this.pfx = this.config.stylePrefix || '';
this.target = o.target || {}; this.target = o.target || {};
this.propTarget = o.propTarget || {}; this.propTarget = o.propTarget || {};
@ -78,17 +79,13 @@ export default Backbone.View.extend({
}, },
render() { render() {
const { pfx, model } = this; const { pfx, model, em, $el } = this;
const { id } = model.attributes; const { id, name } = model.attributes;
this.$el.html( const label = em.t(`styleManager.sectors.${id}`) || name;
this.template({ $el.html(this.template({ pfx, label }));
pfx, this.$caret = $el.find(`#${pfx}caret`);
label: model.get('name')
})
);
this.$caret = this.$el.find(`#${pfx}caret`);
this.renderProperties(); this.renderProperties();
this.$el.attr('class', `${pfx}sector ${pfx}sector__${id} no-select`); $el.attr('class', `${pfx}sector ${pfx}sector__${id} no-select`);
this.updateOpen(); this.updateOpen();
return this; return this;
}, },

Loading…
Cancel
Save