Skip to content

Commit

Permalink
move locales to api. closes #1131
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Jul 14, 2016
1 parent 103ac16 commit 55f4b70
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 18 deletions.
5 changes: 1 addition & 4 deletions api/core/Directus/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ private static function listViews() {
*/
private static function languagesManager()
{
$localesPath = BASE_PATH.'/customs/locales/*.json';
$localesPath = BASE_PATH.'/api/locales/*.json';

$languages = [];
foreach (glob($localesPath) as $filename) {
Expand All @@ -430,7 +430,4 @@ private static function languagesManager()

return new LanguageManager($languages);
}



}
6 changes: 3 additions & 3 deletions api/core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function get_auth_locale() {

$userInfo = \Directus\Auth\Provider::getUserRecord();

return isset($userInfo['locale']) ? $userInfo['locale'] : null;
return isset($userInfo['language']) ? $userInfo['language'] : null;
}
}

Expand All @@ -255,7 +255,7 @@ function is_locale_available($locale) {

if (!function_exists('get_default_phrases')) {
function get_default_phrases() {
$phrasesPath = BASE_PATH.'/app/locales/en.json';
$phrasesPath = BASE_PATH.'/api/locales/en.json';

return json_decode(file_get_contents($phrasesPath), true);
}
Expand All @@ -264,7 +264,7 @@ function get_default_phrases() {
if (!function_exists('get_phrases')) {
function get_phrases($locale = 'en') {
$defaultPhrases = get_default_phrases();
$langFile = BASE_PATH.'/customs/locales/'.$locale.'.json';
$langFile = BASE_PATH.'/api/locales/'.$locale.'.json';

$phrases = [];
if (file_exists($langFile)) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 2 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,6 @@ gulp.task('templates', function() {
.pipe(gulp.dest('dist/app/'));
});


// --------------------
// Locales - Gulp Task
// Languages
// --------------------
gulp.task('locales', function() {
return gulp.src('app/locales/*.json')
.pipe(gulp.dest('dist/app/locales/'));
});

var singlePageFiles = ['./main.html', './login.php'];
gulp.task('singlepage', function () {
return gulp.src(singlePageFiles)
Expand Down Expand Up @@ -255,6 +245,7 @@ gulp.task('move', function() {
var filesToMove = [
'./api/core/**',
'./api/logs/*',
'./api/locales/*.json',
'./api/migrations/**/*',
'./api/views/**/*',
// './api/vendor/**/*.*',
Expand Down Expand Up @@ -334,7 +325,7 @@ gulp.task('jscs', function() {
// Run all the tasks
// ------------------- 'composer',
gulp.task('build', function(cb) {
runSequence(['scripts', 'templates', 'locales', 'singlepage', 'styles', 'fonts', 'images', 'move', 'composer', cb]);
runSequence(['scripts', 'templates', 'singlepage', 'styles', 'fonts', 'images', 'move', 'composer', cb]);
});

// Default task
Expand Down

0 comments on commit 55f4b70

Please sign in to comment.