Skip to content

Commit

Permalink
Merge pull request #19646 from nlfurniss/remove-loc
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic authored Jul 18, 2021
2 parents d823959 + 20b996c commit 7aa0f8d
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 334 deletions.
43 changes: 0 additions & 43 deletions packages/@ember/-internals/glimmer/lib/helpers/loc.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/@ember/-internals/glimmer/lib/setup-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import LinkTo from './components/link-to';
import TextField from './components/text-field';
import Textarea from './components/textarea';
import { clientBuilder, rehydrationBuilder, serializeBuilder } from './dom';
import loc from './helpers/loc';
import { Renderer } from './renderer';
import OutletTemplate from './templates/outlet';
import RootTemplate from './templates/root';
Expand Down Expand Up @@ -55,8 +54,6 @@ export function setupEngineRegistry(registry: Registry): void {

registry.optionsForType('helper', { instantiate: false });

registry.register('helper:loc', loc);

registry.register('component:-text-field', TextField);
registry.register('component:-checkbox', Checkbox);
registry.register('component:input', Input);
Expand Down

This file was deleted.

79 changes: 0 additions & 79 deletions packages/@ember/string/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export { getStrings as _getStrings, setStrings as _setStrings } from './lib/stri
import { ENV } from '@ember/-internals/environment';
import { Cache } from '@ember/-internals/utils';
import { deprecate } from '@ember/debug';
import { getString } from './lib/string_registry';

import {
htmlSafe as internalHtmlSafe,
Expand Down Expand Up @@ -81,66 +80,6 @@ const DECAMELIZE_CACHE = new Cache<string, string>(1000, (str) =>
@public
*/

function _fmt(str: string, formats: any[]) {
// first, replace any ORDERED replacements.
let idx = 0; // the current index for non-numerical replacements
return str.replace(/%@([0-9]+)?/g, (_s: string, argIndex: string) => {
let i = argIndex ? parseInt(argIndex, 10) - 1 : idx++;
let r = i < formats.length ? formats[i] : undefined;
return typeof r === 'string' ? r : r === null ? '(null)' : r === undefined ? '' : String(r);
});
}

/**
Formats the passed string, but first looks up the string in the localized
strings hash. This is a convenient way to localize text.
Note that it is traditional but not required to prefix localized string
keys with an underscore or other character so you can easily identify
localized strings.
```javascript
import { loc } from '@ember/string';
Ember.STRINGS = {
'_Hello World': 'Bonjour le monde',
'_Hello %@ %@': 'Bonjour %@ %@'
};
loc("_Hello World"); // 'Bonjour le monde';
loc("_Hello %@ %@", ["John", "Smith"]); // "Bonjour John Smith";
```
@method loc
@param {String} str The string to format
@param {Array} formats Optional array of parameters to interpolate into string.
@return {String} formatted string
@public
@deprecated
*/
export function loc(str: string, formats: any[]): string {
deprecate(
'loc is deprecated, please use a dedicated localization solution like ember-intl. More alternatives listed at https://emberobserver.com/categories/internationalization.',
false,
{
id: 'ember-string.loc',
until: '4.0.0',
for: 'ember-source',
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-string-loc',
since: {
enabled: '3.24',
},
}
);

if (!Array.isArray(formats) || arguments.length > 2) {
formats = Array.prototype.slice.call(arguments, 1);
}

str = getString(str) || str;
return _fmt(str, formats);
}

/**
Splits a string into separate units separated by spaces, eliminating any
empty strings in the process. This is a convenience method for split that
Expand Down Expand Up @@ -367,24 +306,6 @@ if (ENV.EXTEND_PROTOTYPES.String) {
value: deprecateEmberStringPrototypeExtension('w', w),
},

/**
See [String.loc](/ember/release/classes/String/methods/loc?anchor=loc).
@method loc
@for @ember/string
@static
@private
@deprecated
*/
loc: {
configurable: true,
enumerable: false,
writeable: true,
value(this: string, ...args: any[]) {
return loc(this, args);
},
},

/**
See [String.camelize](/ember/release/classes/String/methods/camelize?anchor=camelize).
Expand Down
80 changes: 0 additions & 80 deletions packages/@ember/string/tests/loc_test.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/ember/tests/reexports_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ let allExports = [
['String.decamelize', '@ember/string', 'decamelize'],
['String.htmlSafe', '@ember/-internals/glimmer', 'htmlSafe'],
['String.isHTMLSafe', '@ember/-internals/glimmer', 'isHTMLSafe'],
['String.loc', '@ember/string', 'loc'],
['String.underscore', '@ember/string', 'underscore'],
['String.w', '@ember/string', 'w'],
['STRINGS', '@ember/string', { get: '_getStrings', set: '_setStrings' }],
Expand Down
1 change: 0 additions & 1 deletion tests/docs/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ module.exports = {
'loading',
'loadingClass',
'loadingHref',
'loc',
'localName',
'location',
'log',
Expand Down

0 comments on commit 7aa0f8d

Please sign in to comment.