Skip to content

Commit

Permalink
chore: rename private methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmit committed Mar 28, 2020
1 parent fdbacb2 commit 631b699
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions addon/services/intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ export default Service.extend(Evented, {
/** @public **/
formats: null,

/**
* Returns an array of registered locale names
*
* @property locales
* @public
*/
locales: computed.readOnly('_translationContainer.locales'),

/** @public **/
locale: computed({
set(_, localeName) {
Expand All @@ -31,7 +39,7 @@ export default Service.extend(Evented, {
this._locale = proposed;
cancel(this._timer);
this._timer = next(() => this.trigger('localeChanged'));
this.updateDocumentLanguage(this._locale);
this._updateDocumentLanguage(this._locale);
}

return this._locale;
Expand Down Expand Up @@ -64,19 +72,11 @@ export default Service.extend(Evented, {
/** @public **/
formatDate: formatter('date'),

/**
* Returns an array of registered locale names
*
* @property locales
* @public
*/
locales: computed.readOnly('_translationContainer.locales'),

/** @private **/
_locale: null,
_translationContainer: null,

/** @private **/
_translationContainer: null,
_locale: null,

/** @private **/
_timer: null,
Expand Down Expand Up @@ -113,7 +113,7 @@ export default Service.extend(Evented, {

/** @public **/
lookup(key, localeName, options = {}) {
const localeNames = this.localeWithDefault(localeName);
const localeNames = this._localeWithDefault(localeName);
let translation;

for (let i = 0; i < localeNames.length; i++) {
Expand Down Expand Up @@ -151,7 +151,7 @@ export default Service.extend(Evented, {

/** @public **/
exists(key, localeName) {
const localeNames = this.localeWithDefault(localeName);
const localeNames = this._localeWithDefault(localeName);

assert(`[ember-intl] locale is unset, cannot lookup '${key}'`, Array.isArray(localeNames) && localeNames.length);

Expand All @@ -174,7 +174,7 @@ export default Service.extend(Evented, {
},

/** @private **/
getFormat(formatType, format) {
_getFormat(formatType, format) {
const formats = get(this, 'formats');

if (formats && formatType && typeof format === 'string') {
Expand All @@ -183,7 +183,7 @@ export default Service.extend(Evented, {
},

/** @private **/
localeWithDefault(localeName) {
_localeWithDefault(localeName) {
if (!localeName) {
return this._locale || [];
}
Expand All @@ -198,7 +198,7 @@ export default Service.extend(Evented, {
},

/** @private **/
updateDocumentLanguage(locales) {
_updateDocumentLanguage(locales) {
const dom = getDOM(this);

if (dom) {
Expand All @@ -214,12 +214,12 @@ function formatter(name) {
let formatOptions = options;

if (options && typeof options.format === 'string') {
formatOptions = assign({}, this.getFormat(name, formatOptions.format), formatOptions);
formatOptions = assign({}, this._getFormat(name, formatOptions.format), formatOptions);
}

return this._formatters[name].format(value, formatOptions, {
formats: formats || this.formats,
locale: this.localeWithDefault(formatOptions && formatOptions.locale),
locale: this._localeWithDefault(formatOptions && formatOptions.locale),
});
};
}

0 comments on commit 631b699

Please sign in to comment.