1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-15 23:28:26 +09:00
misskey/webpack/i18n.ts
2018-05-20 20:26:38 +09:00

20 lines
380 B
TypeScript

/**
* Replace i18n texts
*/
export const pattern = /%i18n:([a-z0-9_\-@\.]+?)%/g;
export const replacement = (ctx, match, key) => {
const client = '/src/client/app/';
let name = null;
if (key[0] == '@') {
name = ctx.src.substr(ctx.src.indexOf(client) + client.length);
key = key.substr(1);
}
const path = name ? `${name}|${key}` : key;
return `%i18n:${path}%`;
};