mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 23:16:21 +00:00
🆙 Init V3
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { GetConfigurationValue } from '../nitro';
|
||||
import { IPageLocalization } from './IPageLocalization';
|
||||
|
||||
export class PageLocalization implements IPageLocalization
|
||||
{
|
||||
private _images: string[];
|
||||
private _texts: string[];
|
||||
|
||||
constructor(images: string[], texts: string[])
|
||||
{
|
||||
this._images = images;
|
||||
this._texts = texts;
|
||||
}
|
||||
|
||||
public getText(index: number): string
|
||||
{
|
||||
let message = (this._texts[index] || '');
|
||||
|
||||
if(message && message.length) message = message.replace(/\r\n|\r|\n/g, '<br />');
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public getImage(index: number): string
|
||||
{
|
||||
const imageName = (this._images[index] || '');
|
||||
|
||||
if(!imageName || !imageName.length) return null;
|
||||
|
||||
let assetUrl = GetConfigurationValue<string>('catalog.asset.image.url');
|
||||
|
||||
assetUrl = assetUrl.replace('%name%', imageName);
|
||||
|
||||
return assetUrl;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user