1
0
Fork 0
mirror of https://gitlab.com/Shinobi-Systems/ShinobiCE.git synced 2025-03-09 15:40:15 +00:00
This commit is contained in:
Moe 2019-10-26 13:34:02 -07:00
parent ef40f3f231
commit 167603dfb0
118 changed files with 16152 additions and 5441 deletions

View file

@ -1,3 +1,4 @@
var fs = require('fs')
module.exports = function(s,config){
if(!config.language){
config.language='en_CA'
@ -9,19 +10,19 @@ module.exports = function(s,config){
console.log('There was an error loading your language file.')
var lang = require(s.location.languages+'/en_CA.json');
}
s.location.definitions = s.mainDirectory+'/definitions'
try{
var definitions = require(s.location.definitions+'/'+config.language+'.json');
}catch(er){
console.error(er)
console.log('There was an error loading your language file.')
var definitions = require(s.location.definitions+'/en_CA.json');
}
//load languages dynamically
s.copySystemDefaultLanguage = function(){
//en_CA
return Object.assign(lang,{})
}
s.listOfPossibleLanguages = []
fs.readdirSync(s.mainDirectory + '/languages').forEach(function(filename){
var name = filename.replace('.json','')
s.listOfPossibleLanguages.push({
"name": name,
"value": name,
})
})
s.loadedLanguages={}
s.loadedLanguages[config.language] = s.copySystemDefaultLanguage()
s.getLanguageFile = function(rule){
@ -41,29 +42,5 @@ module.exports = function(s,config){
}
return file
}
//load defintions dynamically
s.copySystemDefaultDefinitions = function(){
//en_CA
return Object.assign(definitions,{})
}
s.loadedDefinitons={}
s.loadedDefinitons[config.language] = s.copySystemDefaultDefinitions()
s.getDefinitonFile = function(rule){
if(rule && rule !== ''){
var file = s.loadedDefinitons[file]
if(!file){
try{
s.loadedDefinitons[rule] = require(s.location.definitions+'/'+rule+'.json')
s.loadedDefinitons[rule] = Object.assign(s.copySystemDefaultDefinitions(),s.loadedDefinitons[rule])
file = s.loadedDefinitons[rule]
}catch(err){
file = s.copySystemDefaultDefinitions()
}
}
}else{
file = s.copySystemDefaultDefinitions()
}
return file
}
return lang
}