feat: initial
This commit is contained in:
20
index.ts
Normal file
20
index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { gettextToI18next } from 'i18next-conv'
|
||||
|
||||
export default function PoLoader() {
|
||||
return {
|
||||
name: 'po-loader',
|
||||
async transform(source: string, id: string) {
|
||||
const poRegEx = /\.po$/;
|
||||
console.log(id);
|
||||
if (poRegEx.test(id)) {
|
||||
const match = source.match(/Language: (\w+)/)
|
||||
const lang = match ? match[1] : 'en';
|
||||
|
||||
return {
|
||||
code: `export default ${await gettextToI18next(lang, source)}`
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user