Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Update WinSDK.js to handle recursively translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Lopez Guevara authored and fernandolguevara committed Jan 9, 2017
1 parent 2771b2f commit d9e6256
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions windows/lib/WixSDK.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,28 @@ function(app_path, xwalk_path, meta_data, callback) {
return node;
}

var locales_path = path.join(xwalk_path, 'locales', 'xwalk');
if (!fs.existsSync(locales_path))
locales_path = path.join(xwalk_path, 'locales');
if (fs.existsSync(locales_path)) {
var locales = fs.readdirSync(locales_path);
locales.forEach(function (locale) {
AddFileComponent(GetFolderNode('locales', app_root_folder), locales_path, locale);
});
} else {
output.error("Folder 'locales' not found in " + xwalk_path);
output.error("Missing i18n support");
}
function addRecursiveLocales(original_path, sub_folder, root_folder) {
var locales = fs.readdirSync(original_path);

locales.forEach(function(locale) {
var l_path = path.join(original_path, locale);

if (fs.lstatSync(l_path).isFile()) {
AddFileComponent(GetFolderNode(sub_folder, root_folder), original_path, locale);
} else if (fs.lstatSync(l_path).isDirectory()) {
addRecursiveLocales(l_path, locale, GetFolderNode(sub_folder, root_folder));
}
});
}

var locales_path = path.join(xwalk_path, 'locales');

if (fs.existsSync(locales_path)) {
addRecursiveLocales(locales_path, 'locales', app_root_folder);
} else {
output.error("Folder 'locales' not found in " + xwalk_path);
output.error("Missing i18n support");
}

// @skip_array contains absolute path of those need to be skipped, items can be
// directory or files.
Expand Down

0 comments on commit d9e6256

Please sign in to comment.