8e9dab74cccaea416d913b60d8ec992bf4e556076b3af3a84429ed84db0fe808f9a38d096b1ccf941baea15b1af4985674f1240e8a6a784d2139d5de61872e 946 B

12345678910111213141516171819202122232425262728293031323334
  1. import { getLocale } from '../locale/locales';
  2. import { deprecate } from '../utils/deprecate';
  3. // If passed a locale key, it will set the locale for this
  4. // instance. Otherwise, it will return the locale configuration
  5. // variables for this instance.
  6. export function locale(key) {
  7. var newLocaleData;
  8. if (key === undefined) {
  9. return this._locale._abbr;
  10. } else {
  11. newLocaleData = getLocale(key);
  12. if (newLocaleData != null) {
  13. this._locale = newLocaleData;
  14. }
  15. return this;
  16. }
  17. }
  18. export var lang = deprecate(
  19. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  20. function (key) {
  21. if (key === undefined) {
  22. return this.localeData();
  23. } else {
  24. return this.locale(key);
  25. }
  26. }
  27. );
  28. export function localeData() {
  29. return this._locale;
  30. }