Translation loader now ignores system files

I was having an issue with habitrpg failing to load when OSX created a
.DS_Store file in the locales directory. This code fixes that by
ignoring all hidden files (files that start with “.”)
This commit is contained in:
Greg Laabs 2014-05-24 18:04:32 -07:00
parent 29be5d6e3e
commit 49772bb571

View file

@ -17,7 +17,7 @@ var loadTranslations = function(locale){
loadTranslations('en');
fs.readdirSync(path.join(__dirname, "/../node_modules/habitrpg-shared/locales/")).forEach(function(file) {
if(file === 'en' || file === 'README.md') return;
if(file === 'en' || file === 'README.md' || file.indexOf('.') === 0) return;
loadTranslations(file);
// Merge missing strings from english
_.defaults(translations[file], translations.en);