Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ drf-spectacular[sidecar]==0.29.0
google-cloud-translate==3.16.0
gunicorn==23.0.0
markupsafe==2.0.1
moz.l10n[xml]==0.13.0
moz.l10n[xml]==0.14.0
newrelic==9.6.0
openai==2.43.0
PyJWT==2.13.0
Expand Down
9 changes: 6 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1279,9 +1279,9 @@ markupsafe==2.0.1 \
# -c prod.txt
# -r base.in
# jinja2
moz-l10n[xml]==0.13.0 \
--hash=sha256:c194494e48ce1576907c756096186f24dbdd9669d70f6341dddcbed4465a0b3f \
--hash=sha256:c90efd78a2940db57da1fa19307e24f21d27ffb6769a42ca8221f0d3f8aae707
moz-l10n[xml]==0.14.0 \
--hash=sha256:451050fe26ad019f610813e9d9b702484fb0257cf84a6a57d3b9f36c3e99d3ff \
--hash=sha256:65225e6781b29369b2aaf1e8c47a52e403252a8bc69e7792ce35a2c4f3762576
# via
# -c prod.txt
# -r base.in
Expand Down Expand Up @@ -2529,3 +2529,6 @@ zensical==0.0.34 \
# via
# -c prod.txt
# -r base.in

# The following packages were excluded from the output:
# setuptools
9 changes: 6 additions & 3 deletions requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -980,9 +980,9 @@ markupsafe==2.0.1 \
# via
# -r base.in
# jinja2
moz-l10n[xml]==0.13.0 \
--hash=sha256:c194494e48ce1576907c756096186f24dbdd9669d70f6341dddcbed4465a0b3f \
--hash=sha256:c90efd78a2940db57da1fa19307e24f21d27ffb6769a42ca8221f0d3f8aae707
moz-l10n[xml]==0.14.0 \
--hash=sha256:451050fe26ad019f610813e9d9b702484fb0257cf84a6a57d3b9f36c3e99d3ff \
--hash=sha256:65225e6781b29369b2aaf1e8c47a52e403252a8bc69e7792ce35a2c4f3762576
# via -r base.in
newrelic==9.6.0 \
--hash=sha256:01c0eb630bb18261241a37aa0a70cb6f706079a1f58f59f2bb64f26fda54ffc5 \
Expand Down Expand Up @@ -1965,3 +1965,6 @@ zensical==0.0.34 \
--hash=sha256:eb9d880ccb25edba332e1f310b40e65afb0e1072c69530ec02afc6179b33c5ec \
--hash=sha256:f77cb1152b51ccc5bf0c1055ac06802a6eeeff9cb8b4293919300c0becbd26bd
# via -r base.in

# The following packages were excluded from the output:
# setuptools
2 changes: 1 addition & 1 deletion translate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@fluent/langneg": "^0.7.0",
"@fluent/react": "^0.15.1",
"@lezer/highlight": "^1.1.6",
"@mozilla/l10n": "^0.13.0",
"@mozilla/l10n": "^0.14.0",
Comment thread
ewerybody marked this conversation as resolved.
Resolved
"@reduxjs/toolkit": "^1.6.1",
"classnames": "^2.3.1",
"date-and-time": "^0.14.2",
Expand Down
12 changes: 12 additions & 0 deletions translate/src/utils/message/buildMessageEntry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,16 @@ describe('buildMessageEntry', () => {
value: ['Bonjour Monde'],
});
});

it('updates standard xliff entry without Xcode printf variables', () => {
const base = parseEntry('xliff', 'Hello %@');
const result = buildMessageEntry(base, [
{ name: '', keys: [], handle: { current: { value: 'Bonjour %@' } } },
]);
expect(result).toEqual({
format: 'xliff',
id: '',
value: ['Bonjour %@'],
});
});
});
14 changes: 12 additions & 2 deletions translate/src/utils/message/buildMessageEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,26 @@ import type { MessageEntry } from '.';
export function buildMessageEntry(
base: MessageEntry,
fields: EditorField[],
options: { escapeHTML: RegExp | null; trim: boolean } = {
options: {
escapeHTML: RegExp | null;
trim: boolean;
xliffIsXcode?: boolean;
} = {
escapeHTML: null,
trim: false,
xliffIsXcode: false,
Comment thread
ewerybody marked this conversation as resolved.
Resolved
},
): MessageEntry | null {
const res = structuredClone(base);
let format: FormatKey;
let xliffIsXcode = options.xliffIsXcode ?? false;
switch (res.format) {
case 'gettext':
format = 'plain';
break;
case 'xcode':
format = 'xliff';
xliffIsXcode = true;
break;
default:
format = res.format ?? 'plain';
Expand All @@ -40,7 +47,10 @@ export function buildMessageEntry(
if (options.trim) {
src = src.trim();
}
return parsePattern(format, src, msg);
return parsePattern(format, src, {
webextBaseMsg: msg,
xliffIsXcode: xliffIsXcode,
});
};

try {
Expand Down
Loading