Skip to content

Commit 79fc95e

Browse files
authored
Generate locale PO files with extracted comments (#12757)
1 parent 039bc7f commit 79fc95e

File tree

19 files changed

+139
-128
lines changed

19 files changed

+139
-128
lines changed

locale/templates/LC_MESSAGES/amo.pot

Lines changed: 86 additions & 72 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
"@testing-library/react": "^14.1.2",
265265
"@testing-library/user-event": "^14.5.2",
266266
"autoprefixer": "^10.4.16",
267-
"babel-gettext-extractor": "^4.1.3",
267+
"babel-gettext-extractor": "https://github.com/willdurand/babel-gettext-extractor#5.1.0",
268268
"babel-loader": "^9.1.3",
269269
"babel-plugin-dynamic-import-node": "^2.2.0",
270270
"bundlewatch": "^0.3.3",

src/amo/components/AddAddonToCollection/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export class AddAddonToCollectionBase extends React.Component<InternalProps> {
265265
});
266266
}
267267

268-
// translators: This is a header for a list meaning Add to [some collection name]
268+
// L10n: This is a header for a list meaning Add to [some collection name]
269269
const collectionOptLabel = i18n.gettext('Add to…');
270270

271271
return (

src/amo/components/AddonAdminLinks/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class AddonAdminLinksBase extends React.Component<InternalProps> {
7272
>
7373
{
7474
// eslint-disable-next-line max-len
75-
// translators: This action allows the add-on developer or an admin to edit an add-on's properties.
75+
// L10n: This action allows the add-on developer or an admin to edit an add-on's properties.
7676
i18n.gettext('Edit add-on')
7777
}
7878
</a>
@@ -86,7 +86,7 @@ export class AddonAdminLinksBase extends React.Component<InternalProps> {
8686
href={`/admin/models/addons/addon/${addon.id}`}
8787
>
8888
{
89-
// translators: This action allows an admin to maintain an add-on.
89+
// L10n: This action allows an admin to maintain an add-on.
9090
i18n.gettext('Admin add-on')
9191
}
9292
</a>
@@ -100,17 +100,17 @@ export class AddonAdminLinksBase extends React.Component<InternalProps> {
100100
href={`/reviewers/review-content/${addon.id}`}
101101
>
102102
{
103-
// translators: This action allows a reviewer to perform a content review of an add-on.
103+
// L10n: This action allows a reviewer to perform a content review of an add-on.
104104
i18n.gettext('Content review add-on')
105105
}
106106
</a>
107107
</li>
108108
) : null;
109109

110110
const codeReviewLinkText = isTheme
111-
? // translators: This action allows a reviewer to perform a review of a theme.
111+
? // L10n: This action allows a reviewer to perform a review of a theme.
112112
i18n.gettext('Review theme')
113-
: // translators: This action allows a reviewer to perform a review of an add-on's code.
113+
: // L10n: This action allows a reviewer to perform a review of an add-on's code.
114114
i18n.gettext('Review add-on code');
115115
const codeReviewLink =
116116
showCodeReviewLink || showStaticThemeReviewLink ? (
@@ -130,7 +130,7 @@ export class AddonAdminLinksBase extends React.Component<InternalProps> {
130130
<DefinitionList className="AddonAdminLinks">
131131
<Definition
132132
term={
133-
// translators: This is a list of links to administrative functions.
133+
// L10n: This is a list of links to administrative functions.
134134
i18n.gettext('Admin Links')
135135
}
136136
>

src/amo/components/AddonAuthorLinks/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class AddonAuthorLinksBase extends React.Component<InternalProps> {
4747
>
4848
{
4949
// eslint-disable-next-line max-len
50-
// translators: This action allows the add-on developer to edit an add-on's properties.
50+
// L10n: This action allows the add-on developer to edit an add-on's properties.
5151
i18n.gettext('Edit add-on')
5252
}
5353
</a>
@@ -58,7 +58,7 @@ export class AddonAuthorLinksBase extends React.Component<InternalProps> {
5858
<DefinitionList className="AddonAuthorLinks">
5959
<Definition
6060
term={
61-
// translators: This is a list of links to Developer functions.
61+
// L10n: This is a list of links to Developer functions.
6262
i18n.gettext('Author Links')
6363
}
6464
>

src/amo/components/AddonHead/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,55 +65,55 @@ export class AddonHeadBase extends React.Component<InternalProps> {
6565
if (clientApp === CLIENT_APP_ANDROID) {
6666
switch (addon.type) {
6767
case ADDON_TYPE_DICT:
68-
// translators: please keep the fox emoji next to "Firefox Android".
68+
// L10n: please keep the fox emoji next to "Firefox Android".
6969
localizedTitle = i18n.gettext(`%(addonName)s – Get this Dictionary
7070
for 🦊 Firefox Android (%(locale)s)`);
7171
break;
7272
case ADDON_TYPE_EXTENSION:
73-
// translators: please keep the fox emoji next to "Firefox Android".
73+
// L10n: please keep the fox emoji next to "Firefox Android".
7474
localizedTitle = i18n.gettext(`%(addonName)s – Get this Extension for
7575
🦊 Firefox Android (%(locale)s)`);
7676
break;
7777
case ADDON_TYPE_LANG:
78-
// translators: please keep the fox emoji next to "Firefox Android".
78+
// L10n: please keep the fox emoji next to "Firefox Android".
7979
localizedTitle = i18n.gettext(`%(addonName)s – Get this Language Pack
8080
for 🦊 Firefox Android (%(locale)s)`);
8181
break;
8282
case ADDON_TYPE_STATIC_THEME:
83-
// translators: please keep the fox emoji next to "Firefox Android".
83+
// L10n: please keep the fox emoji next to "Firefox Android".
8484
localizedTitle = i18n.gettext(
8585
`%(addonName)s – Get this Theme for 🦊 Firefox Android (%(locale)s)`,
8686
);
8787
break;
8888
default:
89-
// translators: please keep the fox emoji next to "Firefox Android".
89+
// L10n: please keep the fox emoji next to "Firefox Android".
9090
localizedTitle = i18n.gettext(`%(addonName)s – Get this Add-on for 🦊
9191
Firefox Android (%(locale)s)`);
9292
}
9393
} else {
9494
switch (addon.type) {
9595
case ADDON_TYPE_DICT:
96-
// translators: please keep the fox emoji next to "Firefox".
96+
// L10n: please keep the fox emoji next to "Firefox".
9797
localizedTitle = i18n.gettext(`%(addonName)s – Get this Dictionary
9898
for 🦊 Firefox (%(locale)s)`);
9999
break;
100100
case ADDON_TYPE_EXTENSION:
101-
// translators: please keep the fox emoji next to "Firefox".
101+
// L10n: please keep the fox emoji next to "Firefox".
102102
localizedTitle = i18n.gettext(`%(addonName)s – Get this Extension for
103103
🦊 Firefox (%(locale)s)`);
104104
break;
105105
case ADDON_TYPE_LANG:
106-
// translators: please keep the fox emoji next to "Firefox".
106+
// L10n: please keep the fox emoji next to "Firefox".
107107
localizedTitle = i18n.gettext(`%(addonName)s – Get this Language Pack
108108
for 🦊 Firefox (%(locale)s)`);
109109
break;
110110
case ADDON_TYPE_STATIC_THEME:
111-
// translators: please keep the fox emoji next to "Firefox".
111+
// L10n: please keep the fox emoji next to "Firefox".
112112
localizedTitle = i18n.gettext(`%(addonName)s – Get this Theme for 🦊
113113
Firefox (%(locale)s)`);
114114
break;
115115
default:
116-
// translators: please keep the fox emoji next to "Firefox".
116+
// L10n: please keep the fox emoji next to "Firefox".
117117
localizedTitle = i18n.gettext(`%(addonName)s – Get this Add-on for 🦊
118118
Firefox (%(locale)s)`);
119119
}

src/amo/components/AddonMoreInfo/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ export class AddonMoreInfoBase extends React.Component<InternalProps> {
211211
filesize: versionInfo && versionInfo.filesize,
212212
versionLastUpdated: lastUpdated
213213
? i18n.sprintf(
214-
// translators: This will output, in English:
215-
// "2 months ago (Dec 12 2016)"
214+
// L10n: This will output, in English: "2 months ago (Dec 12 2016)"
216215
i18n.gettext('%(timeFromNow)s (%(date)s)'),
217216
{
218217
timeFromNow: i18n.moment(lastUpdated).fromNow(),

src/amo/components/AddonReviewCard/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,15 @@ export class AddonReviewCardBase extends React.Component<InternalProps> {
364364
if (review) {
365365
// eslint-disable-next-line no-nested-ternary
366366
const byLineString = noAuthor
367-
? // translators: Example in English: "posted last week"
367+
? // L10n: Example in English: "posted last week"
368368
i18n.gettext('posted %(linkStart)s%(timestamp)s%(linkEnd)s')
369-
: // translators: Example in English: "by UserName123, last week"
370-
showUserProfileLink
371-
? i18n.gettext(
369+
: showUserProfileLink
370+
? // L10n: Example in English: "by UserName123, last week"
371+
i18n.gettext(
372372
'by %(linkUserProfileStart)s%(authorName)s%(linkUserProfileEnd)s, %(linkStart)s%(timestamp)s%(linkEnd)s',
373373
)
374-
: i18n.gettext(
374+
: // L10n: Example in English: "by UserName123, last week"
375+
i18n.gettext(
375376
'by %(authorName)s, %(linkStart)s%(timestamp)s%(linkEnd)s',
376377
);
377378

src/amo/components/AddonSummaryCard/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const AddonSummaryCardBase = ({
7474
const roundedAverage = roundToOneDigit(addon.ratings.average);
7575
addonAverage = i18n.sprintf(
7676
// eslint-disable-next-line max-len
77-
// translators: roundedAverage is a number rounded to one digit, such as 4.5 in English or ٤٫٧ in Arabic.
77+
// L10n: roundedAverage is a number rounded to one digit, such as 4.5 in English or ٤٫٧ in Arabic.
7878
i18n.ngettext(
7979
'%(rating)s Star out of 5',
8080
'%(rating)s Stars out of 5',

src/amo/components/AddonTitle/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const AddonTitleBase = ({
4545
if (addon && addon.authors) {
4646
const addonAuthors = addon.authors;
4747

48-
// translators: A comma, used in a list of authors: a1, a2, a3.
48+
// L10n: A comma, used in a list of authors: a1, a2, a3.
4949
const comma = i18n.gettext(',');
5050
const separator = isRTL ? ` ${comma}` : `${comma} `;
5151

@@ -89,7 +89,7 @@ export const AddonTitleBase = ({
8989
<>
9090
{authors}{' '}
9191
{
92-
// translators: Example: add-on "by" some authors
92+
// L10n: Example: add-on "by" some authors
9393
i18n.gettext('by')
9494
}
9595
</>

0 commit comments

Comments
 (0)