Replace hard-coded strings with localized strings

This commit is contained in:
KatMelon 2023-04-11 01:24:17 +08:00 committed by GitHub
parent a62b1ab299
commit 05491de3ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import { TImageRawWrap } from '../../texture';
import { getRandomID } from '../../util';
import { ASSERT } from '../../util/error_util';
import { UIUtil } from '../../util/ui_util';
import { LOC } from '../../localiser';
import { AppIcons } from '../icons';
import { ConfigComponent } from './config';
import { ToolbarItemComponent } from './toolbar_item';
@ -15,7 +16,7 @@ export class ImageComponent extends ConfigComponent<Promise<TImageRawWrap>, HTML
super(Promise.resolve(param ?? { raw: '', filetype: 'png' }));
this._switchElement = new ToolbarItemComponent({ id: 'sw', iconSVG: AppIcons.UPLOAD })
.setLabel('Choose')
.setLabel(LOC('materials.components.choose'))
.onClick(() => {
const inputElement = UIUtil.getElementById(this._getId() + '-input') as HTMLInputElement;
inputElement.click();
@ -32,7 +33,7 @@ export class ImageComponent extends ConfigComponent<Promise<TImageRawWrap>, HTML
<div id="${this._imageId}-placeholder" class="texture-preview-placeholder">
<div class="row-container" style="align-items: center;">
<div class="row-item">${AppIcons.IMAGE_MISSING}</div>
<div class="row-item">No image loaded</div>
<div class="row-item">${LOC('materials.components.no_image_loaded')}</div>
</div>
</div>
</div>

View File

@ -1,5 +1,6 @@
import { MaterialType, SolidMaterial, TexturedMaterial } from '../../mesh';
import { AppIcons } from '../icons';
import { LOC } from '../../localiser';
import { ConfigComponent } from './config';
import { ToolbarItemComponent } from './toolbar_item';
@ -13,7 +14,7 @@ export class MaterialTypeComponent extends ConfigComponent<MaterialType, HTMLDiv
this._material = material;
this._solidButton = new ToolbarItemComponent({ id: 'sw1', iconSVG: AppIcons.COLOUR_SWATCH })
.setLabel('Solid')
.setLabel(LOC('materials.components.solid'))
.setGrow()
.onClick(() => {
if (this._material.type === MaterialType.textured) {
@ -22,7 +23,7 @@ export class MaterialTypeComponent extends ConfigComponent<MaterialType, HTMLDiv
});
this._texturedButton = new ToolbarItemComponent({ id: 'sw2', iconSVG: AppIcons.IMAGE })
.setLabel('Textured')
.setLabel(LOC('materials.components.textured'))
.setGrow()
.onClick(() => {
if (this._material.type === MaterialType.solid) {