Skip to content
Merged
Changes from all 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
11 changes: 6 additions & 5 deletions src/blocks/donate/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ export const getFrequencyLabel = ( frequencySlug: DonationFrequencySlug, hideOnc
? hideOnceLabel
? ''
: __( 'once', 'newspack-blocks' )
: sprintf(
// Translators: %s is the frequency (e.g. per month, per year).
_x( 'per %s', 'per `Frequency`', 'newspack-blocks' ),
frequencySlug
);
: ' ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I wonder if this is friendly for all languages? I'm just guessing there might be languages where forcing the frequency string to come after the amount string will result in some potentially funky translations.

Maybe it would be better to add the frequency within the getFormattedAmmount method below so we can generate these translated strings consistently?

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this is the case already before this PR, so I'll go ahead and approve. But I do think this is a good chance to address this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chickenn00dle!

Hmm, I wonder if this is friendly for all languages? I'm just guessing there might be languages where forcing the frequency string to come after the amount string will result in some potentially funky translations.

Yeah, that's a good call! I made myself a separate issue to look at this a little closer (NPPM-2509) 🙂 I also see there's a separate getFrequencyLabelWithAmount const that possibly has the same missing space issue (and order issue - I'm not sure yet! This is the first time I've noticed this change).

sprintf(
// Translators: %s is the frequency (e.g. per month, per year).
_x( 'per %s', 'per `Frequency`', 'newspack-blocks' ),
frequencySlug
);
};

export const getFormattedAmount = ( amount: number, withCurrency = false ) => {
Expand Down