Extract translation strings from Unity YAML files and generate POT files with them.
xgettextUnity(inputFiles, variables, outputFile);
inputFiles
: the list of Unity files to extractvariables
: which YAML variables to look for in the Unity filesoutputFile
: the output POT file (will be overwritten)
Basic
var xgettextUnity = require("xgettext-unity").default;
var inputFiles = ["Assets/Scenes/SampleScene.unity", "Assets/Scenes/MainMenu.unity"];
var outputFile = "Assets/Localization/template.pot";
xgettextUnity(inputFiles, ["m_text"], outputFile);
With glob
var glob = require("glob");
var xgettextUnity = require("xgettext-unity").default;
var inputFiles = glob.sync("Assets/**/*.{unity,prefab}");
var outputFile = "Assets/Localization/template.pot";
xgettextUnity(inputFiles, ["m_text"], outputFile);
The program is licensed under the Apache License 2.0.
npm install
npm run check
npm run build
npm run test