42a94536d1674a1f126867cef7d23f7c5eb8ebe17a63b4ed03112c6e356810a599a23f050491bddcc38b24939627e7f810371de2fe52008c521922589720f8 948 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. }