Skip to content

Commit f38f46a

Browse files
committed
remove deprecated loc
1 parent 7bec45d commit f38f46a

File tree

3 files changed

+0
-138
lines changed

3 files changed

+0
-138
lines changed

addon/index.js

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,6 @@
33
@submodule ember-runtime
44
*/
55
import Cache from './cache';
6-
import { deprecate } from '@ember/application/deprecations';
7-
8-
9-
// STATE within a module is frowned upon, this exists
10-
// to support Ember.STRINGS but shield ember internals from this legacy global
11-
// API.
12-
let STRINGS = {};
13-
14-
export function setStrings(strings) {
15-
STRINGS = strings;
16-
}
17-
18-
export function getStrings() {
19-
return STRINGS;
20-
}
21-
22-
export function getString(name) {
23-
return STRINGS[name];
24-
}
256

267
const STRING_DASHERIZE_REGEXP = (/[ _]/g);
278

@@ -66,61 +47,6 @@ const STRING_DECAMELIZE_REGEXP = (/([a-z\d])([A-Z])/g);
6647

6748
const DECAMELIZE_CACHE = new Cache(1000, str => str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase());
6849

69-
function _fmt(str, formats) {
70-
// first, replace any ORDERED replacements.
71-
let idx = 0; // the current index for non-numerical replacements
72-
return str.replace(/%@([0-9]+)?/g, (_s, argIndex) => {
73-
let i = argIndex ? parseInt(argIndex, 10) - 1 : idx++;
74-
let r = i < formats.length ? formats[i] : undefined;
75-
return typeof r === 'string' ? r : r === null ? '(null)' : r === undefined ? '' : String(r);
76-
});
77-
}
78-
79-
/**
80-
Formats the passed string, but first looks up the string in the localized
81-
strings hash. This is a convenient way to localize text. See
82-
`fmt` for more information on formatting.
83-
84-
Note that it is traditional but not required to prefix localized string
85-
keys with an underscore or other character so you can easily identify
86-
localized strings.
87-
88-
```javascript
89-
import { setStrings, loc } from "@ember/string";
90-
91-
setStrings({
92-
"_Hello World": "Bonjour le monde",
93-
"_Hello %@ %@": "Bonjour %@ %@"
94-
});
95-
96-
loc("_Hello World"); // 'Bonjour le monde';
97-
loc("_Hello %@ %@", ["John", "Smith"]); // "Bonjour John Smith";
98-
```
99-
100-
@method loc
101-
@param {String} str The string to format
102-
@param {Array} formats Optional array of parameters to interpolate into string.
103-
@return {String} formatted string
104-
@public
105-
*/
106-
export function loc(str, formats) {
107-
deprecate(
108-
'loc is deprecated, use an internationalization or localization addon instead.',
109-
false,
110-
{
111-
id: 'ember-string-loc',
112-
until: '2.0.0',
113-
url: 'http://emberjs.com/deprecations/v2.x#toc_ember-string-loc'
114-
}
115-
);
116-
if (!Array.isArray(formats) || arguments.length > 2) {
117-
formats = Array.prototype.slice.call(arguments, 1);
118-
}
119-
120-
str = STRINGS[str] || str;
121-
return _fmt(str, formats);
122-
}
123-
12450
/**
12551
Splits a string into separate units separated by spaces, eliminating any
12652
empty strings in the process. This is a convenience method for split that

tests/integration/helpers/loc-test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/unit/loc_test.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)