Skip to content

FluentBundle.formatPattern #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jul 17, 2019
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
58dbb91
create-runtime
stasm Apr 24, 2019
77fd38d
FluentBundle.formatPattern
stasm Jun 20, 2019
596151b
Update fixtures
stasm Jun 21, 2019
b55c1cb
Always call toString(scope) in formatPattern.
stasm Jun 21, 2019
e04f35e
Fix resolver tests
stasm Jun 25, 2019
5546c40
Don't fall back on message value when attribute was referenced
stasm Jun 25, 2019
d97ed30
Create a fresh dirty WeakSet in each scope
stasm Jun 25, 2019
018ec95
FluentType.toString(scope)
stasm Jun 25, 2019
01adebc
Minor clean-ups in the resolver
stasm Jun 25, 2019
456be2a
Document formatPattern
stasm Jun 25, 2019
386b9ae
TypeError when resolving null/undefined patterns
stasm Jun 25, 2019
42b2e4d
Rename Type to resolve
stasm Jun 25, 2019
24cdba8
Remove the FluentBundle.messages iterator
stasm Jun 25, 2019
28cce8d
Skip scope creation for simple strings
stasm Jun 26, 2019
148a3c9
Speed up addResource by switching to a C-style for loop
stasm Jun 26, 2019
62e1aad
Fix lint
stasm Jun 26, 2019
16fec82
Merge branch 'master' into formatPattern
stasm Jul 10, 2019
29ffcf3
Update fluent-dom
stasm Jul 10, 2019
dbf45f7
Update fluent-react
stasm Jul 10, 2019
466352e
Separate resolveExpression, resolveComplexPattern
stasm Jul 11, 2019
5cd64fc
Document the special case in resolveExpression
stasm Jul 11, 2019
ef1681a
Improve the docstring for formatPattern
stasm Jul 11, 2019
36df8f7
Use strictEqual when comparing against undefined
stasm Jul 11, 2019
9d27d52
Throw on invalid Pattern type
stasm Jul 11, 2019
729cdb7
Fix assert.throws in node 8.9
stasm Jul 12, 2019
50cb03a
Adjust the comment in FluentType.toString()
stasm Jul 15, 2019
dee06b8
Fix cloneElement when child is null or string
stasm Jul 15, 2019
384dc56
fluent-dom: Fix the attribute count check
stasm Jul 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Skip scope creation for simple strings
  • Loading branch information
stasm committed Jun 26, 2019
commit 28cce8de9da25305485d9763b9739328fb30c1d0
4 changes: 3 additions & 1 deletion fluent/src/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ export default class FluentBundle {
* @returns {string}
*/
formatPattern(pattern, args, errors) {
if (typeof pattern === "string" || Array.isArray(pattern)) {
if (typeof pattern === "string") {
return this._transform(pattern);
} else if (Array.isArray(pattern)) {
let scope = this._createScope(args, errors);
let value = resolve(scope, pattern);
return value.toString(scope);
Expand Down