mirror of
https://gitlab.com/Shinobi-Systems/ShinobiCE.git
synced 2025-03-09 15:40:15 +00:00
Blue Turtle - The Refactoring
This commit is contained in:
parent
04011678fb
commit
b7d08eb500
67 changed files with 11651 additions and 8452 deletions
61
libs/language.js
Normal file
61
libs/language.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
module.exports = function(s,config){
|
||||
if(!config.language){
|
||||
config.language='en_CA'
|
||||
}
|
||||
try{
|
||||
var lang = require(s.location.languages+'/'+config.language+'.json');
|
||||
}catch(er){
|
||||
console.error(er)
|
||||
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.loadedLanguages={}
|
||||
s.loadedLanguages[config.language]=lang;
|
||||
s.getLanguageFile = function(rule){
|
||||
if(rule && rule !== ''){
|
||||
var file = s.loadedLanguages[file]
|
||||
if(!file){
|
||||
try{
|
||||
s.loadedLanguages[rule] = require(s.location.languages+'/'+rule+'.json')
|
||||
s.loadedLanguages[rule] = Object.assign(lang,s.loadedLanguages[rule])
|
||||
file = s.loadedLanguages[rule]
|
||||
}catch(err){
|
||||
file = lang
|
||||
}
|
||||
}
|
||||
}else{
|
||||
file = lang
|
||||
}
|
||||
return file
|
||||
}
|
||||
//load defintions dynamically
|
||||
s.loadedDefinitons={}
|
||||
s.loadedDefinitons[config.language]=definitions;
|
||||
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(definitions,s.loadedDefinitons[rule])
|
||||
file = s.loadedDefinitons[rule]
|
||||
}catch(err){
|
||||
file = definitions
|
||||
}
|
||||
}
|
||||
}else{
|
||||
file = definitions
|
||||
}
|
||||
return file
|
||||
}
|
||||
return lang
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue