Skip to content

Commit 35f29cc

Browse files
authored
(fluent-bundle) Rename FluentArgument to FluentVariable (#499)
1 parent 6f9eec1 commit 35f29cc

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

fluent-bundle/src/bundle.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { NUMBER, DATETIME } from "./builtins.js";
77

88
export type TextTransform = (text: string) => string;
99

10-
type NativeArgument = string | number | Date;
11-
export type FluentArgument = FluentValue | NativeArgument;
10+
type NativeValue = string | number | Date;
11+
export type FluentVariable = FluentValue | NativeValue;
1212

1313
/**
1414
* Message bundles are single-language stores of translation resources. They are
@@ -176,7 +176,7 @@ export class FluentBundle {
176176
*/
177177
formatPattern(
178178
pattern: Pattern,
179-
args: Record<string, FluentArgument> | null = null,
179+
args: Record<string, FluentVariable> | null = null,
180180
errors: Array<Error> | null = null
181181
): string {
182182
// Resolve a simple pattern without creating a scope. No error handling is

fluent-bundle/src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
*
88
*/
99

10-
export {
11-
FluentBundle,
12-
FluentArgument,
13-
TextTransform
14-
} from "./bundle.js";
10+
export { FluentBundle, FluentVariable, TextTransform } from "./bundle.js";
1511
export { FluentResource } from "./resource.js";
1612
export {
1713
FluentValue,

fluent-bundle/src/resolver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import {
4444
ComplexPattern,
4545
Pattern
4646
} from "./ast.js";
47-
import { FluentArgument } from "./bundle.js";
47+
import { FluentVariable } from "./bundle.js";
4848

4949
// The maximum number of placeables which can be expanded in a single call to
5050
// `formatPattern`. The limit protects against the Billion Laughs and Quadratic
@@ -153,7 +153,7 @@ function resolveVariableReference(
153153
scope: Scope,
154154
{ name }: VariableReference
155155
): FluentValue {
156-
let arg: FluentArgument;
156+
let arg: FluentVariable;
157157
if (scope.params) {
158158
// We're inside a TermReference. It's OK to reference undefined parameters.
159159
if (Object.prototype.hasOwnProperty.call(scope.params, name)) {

fluent-bundle/src/scope.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FluentBundle, FluentArgument } from "./bundle.js";
1+
import { FluentBundle, FluentVariable } from "./bundle.js";
22
import { ComplexPattern } from "./ast.js";
33

44
export class Scope {
@@ -7,20 +7,20 @@ export class Scope {
77
/** The list of errors collected while resolving. */
88
public errors: Array<Error> | null;
99
/** A dict of developer-provided variables. */
10-
public args: Record<string, FluentArgument> | null;
10+
public args: Record<string, FluentVariable> | null;
1111
/** The Set of patterns already encountered during this resolution.
1212
* Used to detect and prevent cyclic resolutions. */
1313
public dirty: WeakSet<ComplexPattern> = new WeakSet();
1414
/** A dict of parameters passed to a TermReference. */
15-
public params: Record<string, FluentArgument> | null = null;
15+
public params: Record<string, FluentVariable> | null = null;
1616
/** The running count of placeables resolved so far. Used to detect the
1717
* Billion Laughs and Quadratic Blowup attacks. */
1818
public placeables: number = 0;
1919

2020
constructor(
2121
bundle: FluentBundle,
2222
errors: Array<Error> | null,
23-
args: Record<string, FluentArgument> | null,
23+
args: Record<string, FluentVariable> | null,
2424
) {
2525
this.bundle = bundle;
2626
this.errors = errors;

0 commit comments

Comments
 (0)