Skip to content

Commit

Permalink
Extract variable rc_files for clarity
Browse files Browse the repository at this point in the history
I had accidentally applied sort() to the list of translation strings
instead of the list of files, so this would have helped with that.
  • Loading branch information
1j01 committed Mar 1, 2024
1 parent 4df5f53 commit b1ced5e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion localization/preprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const remove_ellipsis = str => str.replace("...", "");
const only_unique = (value, index, self) => self.indexOf(value) === index;

const get_strings = (lang) => {
return glob.sync(`${lang}/**/*.rc`, { cwd: __dirname, absolute: true }).sort((a, b) => a.localeCompare(b, "en")).map(
const rc_files = glob.sync(`${lang}/**/*.rc`, { cwd: __dirname, absolute: true });
rc_files.sort((a, b) => a.localeCompare(b, "en"));
return rc_files.map(
(rc_file) => parse_rc_file(fs.readFileSync(rc_file, "utf16le").replace(/\ufeff/g, ""))
).flat();
};
Expand Down

0 comments on commit b1ced5e

Please sign in to comment.