mirror of
https://github.com/photoprism/photoprism.git
synced 2025-09-26 12:51:31 +08:00
22 lines
659 B
JavaScript
22 lines
659 B
JavaScript
const glob = require("glob");
|
|
const path = require("path");
|
|
const poPath = path.resolve(__dirname, "src/locales");
|
|
|
|
// Generates a list of existing locales based on the files in src/locales.
|
|
const languageCodes = glob.sync(poPath + "/*.po").map((filePath) => {
|
|
const fileName = path.basename(filePath);
|
|
return fileName.replace(".po", "");
|
|
});
|
|
|
|
// Generates one JSON file per locale from the gettext *.po files located in src/locales.
|
|
module.exports = {
|
|
output: {
|
|
path: path.resolve(__dirname, "src/locales"),
|
|
potPath: "src/locales/translations.pot",
|
|
jsonPath: "json",
|
|
locales: languageCodes,
|
|
splitJson: true,
|
|
flat: true,
|
|
},
|
|
};
|