diff --git a/packages/@ember/-internals/glimmer/lib/helpers/loc.ts b/packages/@ember/-internals/glimmer/lib/helpers/loc.ts deleted file mode 100644 index 83a73688d43..00000000000 --- a/packages/@ember/-internals/glimmer/lib/helpers/loc.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** -@module ember -*/ - -import { loc } from '@ember/string'; -import { helper } from '../helper'; - -/** - Calls [String.loc](/ember/release/classes/String/methods/loc?anchor=loc) with the - provided string. This is a convenient way to localize text within a template. - For example: - - ```javascript - Ember.STRINGS = { - '_welcome_': 'Bonjour' - }; - ``` - - ```handlebars -
- ``` - - ```html - - ``` - - See [String.loc](/ember/release/classes/String/methods/loc?anchor=loc) for how to - set up localized string references. - - @method loc - @for Ember.Templates.helpers - @param {String} str The string to format. - @see {String#loc} - @public - @deprecated -*/ -export default helper(function (params) { - return loc.apply(null, params as any /* let the other side handle errors */); -}); diff --git a/packages/@ember/-internals/glimmer/lib/setup-registry.ts b/packages/@ember/-internals/glimmer/lib/setup-registry.ts index 7eb9588f2d6..4bb5844c9a5 100644 --- a/packages/@ember/-internals/glimmer/lib/setup-registry.ts +++ b/packages/@ember/-internals/glimmer/lib/setup-registry.ts @@ -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'; @@ -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); diff --git a/packages/@ember/-internals/glimmer/tests/integration/helpers/loc-test.js b/packages/@ember/-internals/glimmer/tests/integration/helpers/loc-test.js deleted file mode 100644 index b5536b06c82..00000000000 --- a/packages/@ember/-internals/glimmer/tests/integration/helpers/loc-test.js +++ /dev/null @@ -1,127 +0,0 @@ -import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; - -import { set } from '@ember/-internals/metal'; -import { _setStrings } from '@ember/string'; - -moduleFor( - 'Helpers test: {{loc}}', - class extends RenderingTestCase { - constructor() { - super(...arguments); - _setStrings({ - 'Hello Friend': 'Hallo Freund', - Hello: 'Hallo, %@', - }); - } - - teardown() { - super.teardown(); - _setStrings({}); - } - - ['@test it lets the original value through by default']() { - expectDeprecation(() => this.render(`{{loc "Hiya buddy!"}}`), /loc is deprecated/); - this.assertText('Hiya buddy!', 'the unlocalized string is correct'); - runTask(() => this.rerender()); - this.assertText('Hiya buddy!', 'the unlocalized string is correct after rerender'); - } - - ['@test it localizes a simple string']() { - expectDeprecation(() => this.render(`{{loc "Hello Friend"}}`), /loc is deprecated/); - this.assertText('Hallo Freund', 'the localized string is correct'); - runTask(() => this.rerender()); - this.assertText('Hallo Freund', 'the localized string is correct after rerender'); - } - - ['@test it takes passed formats into an account']() { - expectDeprecation(() => { - this.render(`{{loc "%@, %@" "Hello" "Mr. Pitkin"}}`); - }, /loc is deprecated/); - this.assertText('Hello, Mr. Pitkin', 'the formatted string is correct'); - runTask(() => this.rerender()); - this.assertText('Hello, Mr. Pitkin', 'the formatted string is correct after rerender'); - } - - ['@test it updates when bound params change']() { - expectDeprecation(() => { - this.render(`{{loc this.simple}} - {{loc this.personal 'Mr. Pitkin'}}`, { - simple: 'Hello Friend', - personal: 'Hello', - }); - this.assertText('Hallo Freund - Hallo, Mr. Pitkin', 'the bound value is correct'); - }, /loc is deprecated/); - - runTask(() => this.rerender()); - this.assertText( - 'Hallo Freund - Hallo, Mr. Pitkin', - 'the bound value is correct after rerender' - ); - - expectDeprecation(() => { - runTask(() => set(this.context, 'simple', "G'day mate")); - this.assertText( - "G'day mate - Hallo, Mr. Pitkin", - 'the bound value is correct after update' - ); - }, /loc is deprecated/); - - expectDeprecation(() => { - runTask(() => set(this.context, 'simple', 'Hello Friend')); - this.assertText( - 'Hallo Freund - Hallo, Mr. Pitkin', - 'the bound value is correct after reset' - ); - }, /loc is deprecated/); - } - - ['@test it updates when nested bound params change']() { - expectDeprecation(() => { - this.render( - `{{loc this.greetings.simple}} - {{loc this.greetings.personal 'Mr. Pitkin'}}`, - { - greetings: { - simple: 'Hello Friend', - personal: 'Hello', - }, - } - ); - }, /loc is deprecated/); - this.assertText('Hallo Freund - Hallo, Mr. Pitkin', 'the bound value is correct'); - - runTask(() => this.rerender()); - this.assertText( - 'Hallo Freund - Hallo, Mr. Pitkin', - 'the bound value is correct after rerender' - ); - - expectDeprecation(() => { - runTask(() => set(this.context, 'greetings.simple', "G'day mate")); - this.assertText( - "G'day mate - Hallo, Mr. Pitkin", - 'the bound value is correct after interior mutation' - ); - }, /loc is deprecated/); - - expectDeprecation(() => { - runTask(() => - set(this.context, 'greetings', { - simple: 'Hello Friend', - personal: 'Hello', - }) - ); - this.assertText( - 'Hallo Freund - Hallo, Mr. Pitkin', - 'the bound value is correct after replacement' - ); - }, /loc is deprecated/); - } - - ['@test it can be overriden']() { - this.registerHelper('loc', () => 'Yup'); - this.render(`{{loc this.greeting}}`, { - greeting: 'Hello Friend', - }); - this.assertText('Yup', 'the localized string is correct'); - } - } -); diff --git a/packages/@ember/string/index.ts b/packages/@ember/string/index.ts index ce14383b106..ff1ac0ee5ac 100644 --- a/packages/@ember/string/index.ts +++ b/packages/@ember/string/index.ts @@ -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, @@ -81,66 +80,6 @@ const DECAMELIZE_CACHE = new Cache