Skip to content

Use correct translation function for assistive text - #12011

Merged
swissspidy merged 2 commits into
masterfrom
fix/_n
Nov 18, 2018
Merged

swissspidy merged 2 commits into
masterfrom
fix/_n

Conversation

@swissspidy

Copy link
Copy Markdown
Member

Description

The "%s blocks selected." message needs to use the _n() translation function for proper internationalization. Otherwise the wording is not correct for cases where there's only 1 block selected, for example.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@swissspidy swissspidy added Internationalization (i18n) Issues or PRs related to internationalization efforts [Package] Editor /packages/editor labels Nov 17, 2018
@swissspidy
swissspidy requested a review from ocean90 November 17, 2018 12:17
Comment thread packages/editor/src/store/effects.js
@swissspidy
swissspidy merged commit 454415c into master Nov 18, 2018
@swissspidy
swissspidy deleted the fix/_n branch November 18, 2018 14:26
t-hamano added a commit that referenced this pull request Jun 26, 2026
Record gutenberg PR #79584 against the wordpress-develop #12011 backport
so the text shadow support changes are tracked for Core backporting.

Co-Authored-By: Claude <noreply@anthropic.com>
t-hamano added a commit that referenced this pull request Sep 10, 2026
* Block Supports: Add textShadow typography support and UI

Introduce a `typography.textShadow` block support backed by text shadow
presets, end to end:

- Register the `textShadow` typography support key and gate it per block;
  enable it on the paragraph and heading blocks.
- Add `settings.typography.textShadow` and `textShadowPresets` to
  theme.json (defaults, schema, PHP/JS registration) and reuse the
  box-shadow parser for text shadow values.
- Add the Global Styles preset management UI (preview, list, create,
  rename, delete, reset) under Typography, plus a text shadow control in
  the typography panel for both the block inspector and Global Styles.

Presets follow the same model as the other typography preset supports
(font size, font family) rather than the box-shadow inline model: the
chosen preset slug is stored in a dedicated top-level `textShadow`
attribute and emitted as a `has-{slug}-text-shadow` utility class, so
preset selection stays out of the inline style and the generated preset
stylesheet drives the value. Custom (non-preset) values still serialize
inline on `style.typography.textShadow`.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Update getSupportedStyles tests for textShadow

`textShadow` was added to the global supported style list without an
element exclusion, so it is now reported for every element and the
global default. Update the expected lists in the getSupportedStyles
tests to include `textShadow`.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Add backport changelog entry for this PR

Record gutenberg PR #79584 against the wordpress-develop #12011 backport
so the text shadow support changes are tracked for Core backporting.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Add PHP test for preset classname generation

Cover the server-side path that turns a `textShadow` preset attribute into
a `has-{slug}-text-shadow` class, mirroring the existing font family
classname test, so the class-based serialization stays protected.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Add textShadow boolean to TypographySettings type

The `TypographySettings` type gained `textShadowPresets` and
`defaultTextShadowPresets` but not the `textShadow` boolean that gates the
control and exists in the theme.json schema and PHP valid settings, so the
type was internally inconsistent for the feature. Add it.

(The type predates this PR and is still missing several unrelated
typography settings; completing it is left to a separate cleanup.)

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Localize textShadowPresets preset names

Register `typography.textShadowPresets[].name` in the theme i18n schema
(top level and per-block) so theme-defined text shadow preset names are
translatable, matching font sizes, font families, and shadow presets.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Add a Default option to the preset select

When seven or more presets render the picker as a SelectControl, an unset
value showed the first preset as selected because no empty option existed.
Prepend a "Default" option so an unset text shadow is represented and
selecting it clears the value.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Add a None option to unset an inherited text shadow

The text shadow popover only let users pick a preset or reset to the
Default (inherited) value, so there was no way to explicitly remove a
text shadow inherited from theme.json or a parent level. Add a "None"
choice that sets `text-shadow: none`, giving users a way to cancel out
an upper-level text shadow. Base the compact/select display threshold on
the preset count so the added choice does not shift the cutoff.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Document the textShadow preset attribute in block supports

The typography.textShadow docs only described the custom `style`
attribute, omitting the top-level `textShadow` attribute that stores a
selected preset slug. Document both attributes, mirroring the
typography.fontSize section, so block authors know how to set a default
preset text shadow.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text shadow: Resolve the selected preset by slug instead of by value

The popover matched the decoded CSS value back to a preset to determine
selection, so two presets sharing the same textShadow value would
resolve to the wrong entry. Pass the raw value through and extract the
preset slug from it (mirroring the font size pattern), using the decoded
value only for the live preview.

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant __next40pxDefaultSize prop from text shadow controls

SelectControl and UnitControl already default to the 40px size, so the
prop is a no-op and triggers deprecation lint warnings.

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove backport changelog entry

* Global Styles: Drop redundant __next40pxDefaultSize from rename InputControl

`__next40pxDefaultSize` is now true by default for `InputControl`, so passing
it explicitly is a no-op that only adds noise.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Migrate the presets screen to the preset management layer

Trunk's shadows preset migration (#79812) removed
`confirm-reset-shadow-dialog.tsx`, which the text shadows screen still
imported, breaking the TypeScript build. Rebuild `ScreenTextShadows` on
the same `usePresets` + `PresetGroup` layer that `ShadowsPanel` now uses,
which drops the local `TextShadowList` component and routes the reset
confirmation through `presets/dialogs/confirm-reset-dialog`.

Also drop the now single-use `__text-shadows-panel__options-container`
selector in favour of the existing `__shadows-panel__options-container`,
which `shadows-edit-panel.tsx` already uses for the same purpose.

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Align the inspector item and edit screen with trunk's shared layers

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Replace legacy layout primitives to clear eslint suppressions

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Remove a stray blank line from the VALID_SETTINGS docblock

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Add changelog entries for the affected packages

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Render the preset list as a listbox instead of menu items

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Name the target in the remove button label

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Drop the unused resetTextShadow export

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Position the remove button with offsets instead of dead auto margins

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Target 7.2.0 in the @SInCE tags for the new presets

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Add the Core backport changelog entry for 7.2

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Import kebabCase from its own package to fix the preset class name

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Build the preset list from Button and Stack for stable row heights

Co-Authored-By: Claude <noreply@anthropic.com>

* Text Shadows: Convert the new block editor files to TypeScript

* Text Shadows: Read the typography setting directly instead of unlocking a private API

* Text Shadows: Allow text-shadow in KSES so users without unfiltered_html keep the style

Co-Authored-By: Claude <noreply@anthropic.com>

* Global Styles UI: Use sentence case for 'Text shadows' labels

Co-Authored-By: Claude <noreply@anthropic.com>

* Global Styles: Define text shadow presets in em so shadows scale with font size

Co-Authored-By: Claude <noreply@anthropic.com>

* Global Styles: Drop the Outlined text shadow preset as it does not outline text

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Unlinked contributors: HatlerRyan, jnweaver, gracie, burnuser.

Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: bph <bph@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: beafialho <beafialho@git.wordpress.org>
Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>
Co-authored-by: UltimateByte <robin-labadie@git.wordpress.org>
Co-authored-by: ryanwelcher <welcher@git.wordpress.org>
Co-authored-by: karmatosed <karmatosed@git.wordpress.org>
Co-authored-by: USERSATOSHI <tusharbharti@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: kedarjoyner <kjoyner@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Internationalization (i18n) Issues or PRs related to internationalization efforts [Package] Editor /packages/editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants