Skip to content

Commit

Permalink
Hide translate from public for now
Browse files Browse the repository at this point in the history
Check arethusa.js for a longer description on the reasons for this.
  • Loading branch information
LFDM committed Jul 20, 2014
1 parent f60f84c commit cae2091
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 21 deletions.
35 changes: 20 additions & 15 deletions app/js/arethusa.core/directives/translate_language.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@ angular.module('arethusa.core').directive('translateLanguage', [
restrict: 'A',
scope: {},
link: function(scope, element, attrs) {
function useKey(key) {
scope.langKey = key || $translate.use();
$translate.use(scope.langKey);
}
//function useKey(key) {
//scope.langKey = key || $translate.use();
//$translate.use(scope.langKey);
//}

var langs = ['en', 'de'];
//var langs = ['en', 'de'];

function toggleLang() {
var i;
i = langs.indexOf(scope.langKey) + 1;
i = i > langs.length - 1 ? 0 : i;
useKey(langs[i]);
}
//function toggleLang() {
//var i;
//i = langs.indexOf(scope.langKey) + 1;
//i = i > langs.length - 1 ? 0 : i;
//useKey(langs[i]);
//}

element.bind('click', function() {
scope.$apply(toggleLang);
});
// Check the comment in arethusa.js to learn why this is commented out,
// hardcoded to 'en' and hidden for now.
//
//element.bind('click', function() {
//scope.$apply(toggleLang);
//});

useKey();
//useKey();
element.hide();
$translate.use('en');
},
templateUrl: 'templates/arethusa.core/translate_language.html'
};
Expand Down
22 changes: 16 additions & 6 deletions app/js/arethusa.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,21 @@ angular.module('arethusa').config([
prefix: 'static/i18n/',
suffix: '.json'
})
.registerAvailableLanguageKeys(['en', 'de'], {
'en_*' : 'en',
'de_*' : 'de'
})
.determinePreferredLanguage()
.fallbackLanguage('en');

// Right now we only support English. Still many strings we need to
// change to the new translate syntax. Once we've made progress with it,
// we activate it again.
// The reason we include it right now is that we want to use it for all
// future strings. We're too far behind on l10n/i18n matters - don't want
// to make the situation worse.
//
//.registerAvailableLanguageKeys(['en', 'de'], {
//'en_*' : 'en',
//'de_*' : 'de'
//})
//.determinePreferredLanguage()
//.fallbackLanguage('en');
.registerAvailableLanguageKeys(['en'])
.preferredLanguage('en');
}
]);

0 comments on commit cae2091

Please sign in to comment.