return this.getLoginEnvironmentFromShell(function(error, environment) { if (!environment) { console.warn(`ShellEnvironment.getBestEnvironment: ${error}`); environment = Object.assign({}, process.env); } if (!environment.LANG) { Locale().then((locale) => { environment.LANG = `${locale}.UTF-8` console.log(`ShellEnvironment.getBestEnvironment: LANG=${environment.LANG}`) callback(error, environment); }).catch((error) => { callback(error, environment); }) } else { callback(error, environment); } });
describe('Terminal Prompt', function() { var scaffoldPrompt = require('../util.js'); var osLocale = require('os-locale'); var constants = osLocale(function(err, locale) { constants = require('../locales/en.json'); if (locale === 'es_ES') { constants = require('../locales/es.json'); } if (locale === 'pt_PT') { constants = require('../locales/pt.json'); } }); describe('Components Terminal Prompt', function() { it('should Component input needs to have this properties', function(done) { var modulePrompt = scaffoldPrompt.componentsTerminal()[0]; modulePrompt.type.should.equal('input'); modulePrompt.name.should.equal('fileName'); modulePrompt.message.should.equal('Type the name of your component?'); done(); }); it('should Module input needs to have this properties', function(done) { var modulePrompt = scaffoldPrompt.componentsTerminal()[1]; modulePrompt.type.should.equal('input'); modulePrompt.name.should.equal('module'); modulePrompt.message.should.equal('Type the name of the AngularJs module?'); done(); }); it('should TDD input needs to have this properties', function(done) { var modulePrompt = scaffoldPrompt.componentsTerminal()[2]; modulePrompt.type.should.equal('input'); modulePrompt.name.should.equal('pathTemplates'); modulePrompt.message.should.equal('Type the path for templates?'); done(); }); it('should TDD input needs to have this properties', function(done) { var modulePrompt = scaffoldPrompt.componentsTerminal()[3]; modulePrompt.type.should.equal('confirm'); modulePrompt.name.should.equal('spec'); modulePrompt.message.should.equal('Do you want to include unit testing?'); done(); }); }); describe('ngService Terminal Prompt', function() { it('should ngService input needs to have this properties', function(done) { var modulePrompt = scaffoldPrompt.ngServiceTerminal()[0]; modulePrompt.type.should.equal('input'); modulePrompt.name.should.equal(constants.ngService.FOLDER_NAME); modulePrompt.message.should.equal(constants.ngService.FOLDER_MESSAGE); modulePrompt.default.should.equal(constants.ngService.FOLDER_DEFAULT); done(); }); }); describe('mockServiceTerminal Terminal Prompt', function() { it('should mockServiceTerminal input needs to have this properties', function(done) { var modulePrompt = scaffoldPrompt.mockServiceTerminal()[0]; modulePrompt.type.should.equal('input'); modulePrompt.name.should.equal(constants.mockService.FOLDER_NAME); modulePrompt.message.should.equal(constants.mockService.FOLDER_MESSAGE); modulePrompt.default.should.equal(constants.mockService.FOLDER_DEFAULT); done(); }); }); });
var app = angular.module('cdg', ['ui.router','angularUtils.directives.dirPagination','pascalprecht.translate','ngCookies']); const fs = require("fs"); const path = require("path"); const sqlite3 = require('sqlite3').verbose(); // For detect os language var osLocale = require('os-locale'); osLocale(function (err, locale) { console.log(locale); //=> 'en_US' }); app.directive('loading', function () { return { restrict: 'E', replace:true, template: '<div class="loading"><img src="./images/ajax-loader.gif" width="20" height="20" />LOADING...</div>', link: function (scope, element, attr) { scope.$watch('loading', function (val) { if (val) $(element).show(); else $(element).hide(); }); } } }) app.config(function($stateProvider,$urlRouterProvider){ $stateProvider.state('/',{
function setDefaultLocale() { osLocale().then(setLocale).catch(); }