feat(next): add l10n grunt scripts

Because:

* Add grunt script used to manage and update l10n ftl files used by
  payments next

This commit:

* Adds grunt scripts copy:branding-ftl, concat:ftl and watch:ftl

Closes #FXA-8819
This commit is contained in:
Reino Muhl 2024-03-06 14:51:14 -05:00
Родитель 0f37d42b15
Коммит a11256cb50
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C86660FCF998897A
13 изменённых файлов: 138 добавлений и 48 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -134,6 +134,9 @@ packages/fxa-payments-server/fxa-content-server-l10n/
packages/fxa-payments-server/public/locales
packages/fxa-payments-server/test
# payments-next
apps/payments/next/public/locales
# fxa-profile-server
packages/fxa-profile-server/var
packages/fxa-profile-server/BUCKET_NAME

Просмотреть файл

@ -0,0 +1,48 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module.exports = function (grunt) {
const srcPaths = [
'.license.header',
'app/**/*.ftl',
'../../../libs/payments/ui/src/lib/**/*.ftl'
];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// make a copy of the local branding terms available for local development
// before they are extracted to the l10n repo
// this file will not be included in the string extraction process, so should not lead to duplication
copy: {
'branding-ftl': {
nonull: true,
src: '../../../libs/shared/l10n/src/lib/branding.ftl',
dest: 'public/locales/en/branding.ftl',
},
},
concat: {
ftl: {
src: srcPaths,
dest: 'public/locales/en/payments.ftl',
},
},
watch: {
ftl: {
files: srcPaths,
tasks: ['merge-ftl'],
options: {
interrupt: true,
},
},
},
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('merge-ftl', ['copy:branding-ftl', 'concat:ftl']);
grunt.registerTask('watch-ftl', ['watch:ftl']);
};

Просмотреть файл

@ -79,6 +79,9 @@
"delete": {
"command": "pm2 delete apps/payments/next/pm2.config.js"
},
"l10n-merge": {
"command": "yarn grunt --gruntfile='apps/payments/next/Gruntfile.js' merge-ftl"
},
"storybook": {
"executor": "@nx/storybook:storybook",
"options": {

Просмотреть файл

@ -1,15 +1,15 @@
## Component - PlanDetails
plan-details-header = Produktdetails
plan-details-list-price = Listenpreis
plan-details-show-button = Details anzeigen
plan-details-hide-button = Details ausblenden
plan-details-total-label = Gesamt
plan-details-tax = Steuern und Gebühren
next-plan-details-header = Produktdetails
next-plan-details-list-price = Listenpreis
next-plan-details-show-button = Details anzeigen
next-plan-details-hide-button = Details ausblenden
next-plan-details-total-label = Gesamt
next-plan-details-tax = Steuern und Gebühren
terms = Nutzungsbedingungen
privacy = Datenschutzhinweis
terms-download = Nutzungsbedingungen herunterladen
next-terms = Nutzungsbedingungen
next-privacy = Datenschutzhinweis
next-terms-download = Nutzungsbedingungen herunterladen
payment-confirmation-thanks-heading = Vielen Dank!

Просмотреть файл

@ -1,11 +1,11 @@
## Component - PlanDetails
plan-details-header = Product details
plan-details-list-price = List Price
plan-details-show-button = Show details
plan-details-hide-button = Hide details
plan-details-total-label = Total
plan-details-tax = Taxes and Fees
next-plan-details-header = Product details
next-plan-details-list-price = List Price
next-plan-details-show-button = Show details
next-plan-details-hide-button = Hide details
next-plan-details-total-label = Total
next-plan-details-tax = Taxes and Fees
## Subscription upgrade plan details - shared by multiple components, including plan details and payment form
## $amount (Number) - The amount billed. It will be formatted as currency.
@ -24,9 +24,9 @@ plan-price-interval-yearly = { $amount } yearly
list-positive-amount = { $amount }
list-negative-amount = - { $amount }
terms = Terms of Service
privacy = Privacy Notice
terms-download = Download Terms
next-terms = Terms of Service
next-privacy = Privacy Notice
next-terms-download = Download Terms
payment-confirmation-thanks-heading = Thank you!

Просмотреть файл

@ -1,11 +1,11 @@
## Component - PlanDetails
plan-details-header = Detalles del producto
plan-details-list-price = Lista de precios
plan-details-show-button = Mostrar detalles
plan-details-hide-button = Ocultar detalles
plan-details-total-label = Total
plan-details-tax = Impuestos y tasas
next-plan-details-header = Detalles del producto
next-plan-details-list-price = Lista de precios
next-plan-details-show-button = Mostrar detalles
next-plan-details-hide-button = Ocultar detalles
next-plan-details-total-label = Total
next-plan-details-tax = Impuestos y tasas
plan-price-interval-day =
{ $intervalCount ->
@ -51,9 +51,9 @@ plan-price-interval-year =
*[other] { $amount } cada { $intervalCount } años
}
terms = Términos del servicio
privacy = Aviso de privacidad
terms-download = Descargar términos
next-terms = Términos del servicio
next-privacy = Aviso de privacidad
next-terms-download = Descargar términos
payment-confirmation-thanks-heading = ¡Gracias!

Просмотреть файл

@ -1,11 +1,11 @@
## Component - PlanDetails
plan-details-header = Détails du produit
plan-details-list-price = Prix courant
plan-details-show-button = Afficher les détails
plan-details-hide-button = Masquer les détails
plan-details-total-label = Total
plan-details-tax = Taxes et frais
next-plan-details-header = Détails du produit
next-plan-details-list-price = Prix courant
next-plan-details-show-button = Afficher les détails
next-plan-details-hide-button = Masquer les détails
next-plan-details-total-label = Total
next-plan-details-tax = Taxes et frais
## Subscription upgrade plan details - shared by multiple components, including plan details and payment form
## $amount (Number) - The amount billed. It will be formatted as currency.
@ -24,9 +24,9 @@ plan-price-interval-yearly = { $amount } par an
list-positive-amount = { $amount }
list-negative-amount = - { $amount }
terms = Conditions dutilisation
privacy = Politique de confidentialité
terms-download = Télécharger les conditions
next-terms = Conditions dutilisation
next-privacy = Politique de confidentialité
next-terms-download = Télécharger les conditions
payment-confirmation-thanks-heading = Merci !

Просмотреть файл

@ -0,0 +1,20 @@
## Component - PurchaseDetails
next-plan-details-header = Product details
next-plan-details-list-price = List Price
next-plan-details-tax = Taxes and Fees
next-plan-details-total-label = Total
# Title of container where a user can input a coupon code to get a discount on a subscription.
next-coupon-promo-code = Promo Code
## Purchase details - shared by multiple components, including purchase details and payment form
## $amount (Number) - The amount billed. It will be formatted as currency.
plan-price-interval-daily = { $amount } daily
plan-price-interval-weekly = { $amount } weekly
plan-price-interval-monthly = { $amount } monthly
plan-price-interval-6monthly = { $amount } every 6 months
plan-price-interval-yearly = { $amount } yearly
list-positive-amount = { $amount }
list-negative-amount = - { $amount }

Просмотреть файл

@ -118,7 +118,7 @@ export async function PurchaseDetails(props: PurchaseDetailsProps) {
</div>
<h3 className="text-grey-600 font-semibold my-4">
{l10n.getMessage('plan-details-header')?.value?.toString() ||
{l10n.getMessage('next-plan-details-header')?.value?.toString() ||
`Plan Details`}
</h3>
@ -134,7 +134,7 @@ export async function PurchaseDetails(props: PurchaseDetailsProps) {
{!!listAmount && (
<ListLabelItem
{...{
labelLocalizationId: 'plan-details-list-price',
labelLocalizationId: 'next-plan-details-list-price',
labelFallbackText: 'List Price',
amount: listAmount,
currency,
@ -146,7 +146,7 @@ export async function PurchaseDetails(props: PurchaseDetailsProps) {
{!!discountAmount && (
<ListLabelItem
{...{
labelLocalizationId: 'coupon-promo-code',
labelLocalizationId: 'next-coupon-promo-code',
labelFallbackText: 'Promo Code',
amount: discountAmount,
currency,
@ -159,7 +159,7 @@ export async function PurchaseDetails(props: PurchaseDetailsProps) {
{exclusiveTaxRates.length === 1 && (
<ListLabelItem
{...{
labelLocalizationId: 'plan-details-tax',
labelLocalizationId: 'next-plan-details-tax',
labelFallbackText: 'Taxes and Fees',
amount: exclusiveTaxRates[0].amount,
currency,
@ -185,8 +185,9 @@ export async function PurchaseDetails(props: PurchaseDetailsProps) {
<div className="plan-details-item pt-4 pb-6 font-semibold">
<span className="text-base">
{l10n.getMessage('plan-details-total-label')?.value?.toString() ||
`Total`}
{l10n
.getMessage('next-plan-details-total-label')
?.value?.toString() || `Total`}
</span>
<span
className="overflow-hidden text-ellipsis text-lg whitespace-nowrap"

Просмотреть файл

@ -0,0 +1,5 @@
## Component - TermsAndPrivacy
next-terms = Terms of Service
next-privacy = Privacy Notice
next-terms-download = Download Terms

Просмотреть файл

@ -88,13 +88,13 @@ export function buildFirefoxAccountsTerms(
key: 'fxa-terms-1',
href: `${contentServerURL}/legal/terms`,
text: 'Terms of Service',
localizationId: 'terms',
localizationId: 'next-terms',
},
{
key: 'fxa-terms-2',
href: `${contentServerURL}/legal/privacy`,
text: 'Privacy Notice',
localizationId: 'privacy',
localizationId: 'next-privacy',
},
],
},
@ -114,7 +114,7 @@ export function buildProductTerms(
key: 'product-terms-1',
href: termsOfService,
text: 'Terms of Service',
localizationId: 'terms',
localizationId: 'next-terms',
});
}
@ -123,7 +123,7 @@ export function buildProductTerms(
key: 'product-terms-2',
href: privacyNotice,
text: 'Privacy Notice',
localizationId: 'privacy',
localizationId: 'next-privacy',
});
}
@ -132,7 +132,7 @@ export function buildProductTerms(
key: 'product-terms-3',
href: termsOfServiceDownload,
text: 'Download Terms',
localizationId: 'terms-download',
localizationId: 'next-terms-download',
});
}

Просмотреть файл

@ -194,6 +194,11 @@
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"grunt": "^1.6.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-concat": "^2.1.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.1.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-environment-node": "^29.7.0",

Просмотреть файл

@ -38711,6 +38711,11 @@ fsevents@~2.1.1:
eslint-plugin-react-hooks: 4.6.0
graphql: ^16.8.0
graphql-request: ^6.1.0
grunt: ^1.6.1
grunt-cli: ^1.4.3
grunt-contrib-concat: ^2.1.0
grunt-contrib-copy: ^1.0.0
grunt-contrib-watch: ^1.1.0
hot-shots: ^10.0.0
husky: ^4.2.5
jest: ^29.5.0
@ -40092,7 +40097,7 @@ fsevents@~2.1.1:
languageName: node
linkType: hard
"grunt-contrib-copy@npm:1.0.0":
"grunt-contrib-copy@npm:1.0.0, grunt-contrib-copy@npm:^1.0.0":
version: 1.0.0
resolution: "grunt-contrib-copy@npm:1.0.0"
dependencies: