Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
feat(service): add $translate.resolveClientLocale() (also at provider)
Browse files Browse the repository at this point in the history
This is the expose of the internally used `getLocale()`.

```
$translate.resolveClientLocale()
$translateProvider.resolveClientLocale()
```
  • Loading branch information
knalli committed Mar 20, 2016
1 parent 14bc956 commit d0469ac
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/service/translate.js
Expand Up @@ -547,6 +547,20 @@ function $translate($STORAGE_KEY, $windowProvider, $translateSanitizationProvide
return $uses;
};

/**
* @ngdoc function
* @name pascalprecht.translate.$translateProvider#resolveClientLocale
* @methodOf pascalprecht.translate.$translateProvider
*
* @description
* This returns the current browser/client's language key. The result is processed with the configured uniform tag resolver.
*
* @returns {string} the current client/browser language key
*/
this.resolveClientLocale = function () {
return getLocale();
};

/**
* @ngdoc function
* @name pascalprecht.translate.$translateProvider#storageKey
Expand Down Expand Up @@ -1881,6 +1895,20 @@ function $translate($STORAGE_KEY, $windowProvider, $translateSanitizationProvide
return deferred.promise;
};

/**
* @ngdoc function
* @name pascalprecht.translate.$translate#resolveClientLocale
* @methodOf pascalprecht.translate.$translate
*
* @description
* This returns the current browser/client's language key. The result is processed with the configured uniform tag resolver.
*
* @returns {string} the current client/browser language key
*/
$translate.resolveClientLocale = function () {
return getLocale();
};

/**
* @ngdoc function
* @name pascalprecht.translate.$translate#storageKey
Expand Down

0 comments on commit d0469ac

Please sign in to comment.