Skip to content

Commit

Permalink
Exclude deprecated locale files when building
Browse files Browse the repository at this point in the history
Fixes #721
  • Loading branch information
gilmoreorless committed Sep 9, 2023
1 parent c612952 commit 61dbd7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 0 additions & 4 deletions data/locale.js
Expand Up @@ -328,10 +328,6 @@ module.exports =[
"abbr": "mk",
"name": "Macedonian"
},
{
"abbr": "ms-my",
"name": "Malay"
},
{
"abbr": "ms",
"name": "Malay"
Expand Down
11 changes: 8 additions & 3 deletions tasks/update-locales.js
Expand Up @@ -10,20 +10,25 @@ module.exports = function (grunt) {
locales = {en: 'English (United States)'},
numErrors = 0;
fs.readdirSync(localesDir).forEach(function (localeFile) {
var localeName = null, localeAbbr = null;
var localeName = null,
localeAbbr = null,
isDeprecated = false;
grunt.file.read(join(localesDir, localeFile)).split(/\n|\r|\r\n/).forEach(function (line) {
if (line.slice(0, 10) === '//! locale') {
if (line.startsWith('//! locale')) {
localeName = line.split(' : ')[1].split(' [')[0].trim();
localeAbbr = line.split(' : ')[1].split(/\[|\]/)[1];
}
if (line.startsWith('//! note : DEPRECATED')) {
isDeprecated = true;
}
});
if (localeName == null) {
grunt.log.error('wtf', localeFile);
numErrors += 1;
} else if (localeAbbr !== localeFile.split('.')[0]) {
grunt.log.error('wtf2', localeFile, localeAbbr, localeName);
numErrors += 1;
} else {
} else if (!isDeprecated) {
// grunt.log.writeln(localeAbbr, localeName);
locales[localeAbbr] = localeName;
}
Expand Down

0 comments on commit 61dbd7c

Please sign in to comment.