Skip to content

Instantly share code, notes, and snippets.

@gsans
Created December 1, 2014 12:02
Show Gist options
  • Save gsans/03ac638c5d69be51c4ef to your computer and use it in GitHub Desktop.
Save gsans/03ac638c5d69be51c4ef to your computer and use it in GitHub Desktop.
.config(function($httpProvider, $translateProvider) {
… //seen before
})
// Service definition
.factory(‘Language’, function ($translate) {
//add the languages you support here. ar stands for arabic
var rtlLanguages = [‘ar’];
var isRtl = function() {
var languageKey = $translate.proposedLanguage() || $translate.use();
for (var i=0; i<rtlLanguages.length; i+=1) {
if (languageKey.indexOf(rtlLanguages[i])>-1)
return true;
}
return false;
};
//public api
return {
isRtl: isRtl
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment