Skip to content

feat(react-icons): add localized icon variants - #1261

Merged
Martin Hochel (Hotell) merged 7 commits into
microsoft:mainfrom
Hotell:feat/localized-react-icons
Oct 22, 2026
Merged

Martin Hochel (Hotell) merged 7 commits into
microsoft:mainfrom
Hotell:feat/localized-react-icons

Conversation

@Hotell

@Hotell Martin Hochel (Hotell) commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Human Reviewer Focus

Most of this PR's size comes from regenerated artifacts. Please prioritize these four areas:

  1. Shared importer naming API: Review the unified build-time helpers in importer/icon-name.js, now reused by the React SVG/font scaffolding. Focus on locale parsing, export/module naming, raw glyph identities, and directionality behavior rather than duplicated naming logic in each generator.
  2. Expected icon additions: Review packages/react-icons/snapshots/build-verify.test.js.snap to verify the added locale-specific icon/atom groups and that existing groups remain intact. These are generated verification snapshots, not hand-written icon implementations.
  3. Generated font boilerplate: The complete fonts/ output is regenerated, including CSS/HTML previews, TTF/WOFF/WOFF2 binaries, and all codepoint maps. The maps contain the entire glyph catalogue, not just the localized additions. Review the generation logic and preservation of published codepoint assignments; the large font/artifact diff is generated output.
  4. Locale-aware atomic loader: Review packages/react-icons-atomic-webpack-loader/src/modules.ts and src/selector-protocol.ts, plus their tests. The loader now recognizes locale-qualified exports and resolves the new naming pattern, for example TextBoldRegular_srCyrl to text-bold_sr-cyrl, including per-export selector mode.

Summary

Add explicit, source-backed localized icon exports across SVG, headless SVG, fonts, and headless fonts without runtime locale selection.

import { TextBold24Regular_es } from '@fluentui/react-icons';
import { TextBoldRegular_srCyrl } from '@fluentui/react-icons/svg/text-bold_sr-cyrl';
  • Keep an underscore between the icon name and locale; use camel-cased locale identifiers and hyphenated module tags (_srCyrl → _sr-cyrl).
  • Generate locale-specific atom groups and update barrel/atomic transforms, metadata, and documentation.
  • Extend the existing font families with localized glyphs while preserving original glyph codepoints.
  • Preserve existing directional exports and apply metadata-driven mirroring without adding duplicate direction-only aliases.
  • Cover locale support in importer generation, atomization, font/SVG subsetting, and browser rendering.
  • Keep unchanged named-import JS/CSS budgets separate from the intentionally larger whole-library exports and full fonts.

Related Work

Addresses #1258.

The baseline prefer-resizable correction is being reviewed separately in #1260. This branch also includes its locale-aware adaptation: only suggest existing system-icon counterparts, preserve locale suffixes, and exclude Light variants by design. The generated non-Light exception list contains 236 entries on this branch. Brand/custom-source behavior remains unchanged.

Validation

  • Importer-owned naming/font-generation tests and infrastructure typecheck.
  • React converter/unit tests and generated-package verification, including native ESM/CJS loading and Babel/SWC mappings.
  • Webpack/rspack font subsetting and atomic-loader integrations; SVG-sprite subsetting fixtures.
  • Playwright full/subset font rendering across standard/headless APIs, LTR/RTL contexts, and desktop/mobile viewports.
  • Seven unchanged named-import routes showed no JS/CSS growth for minified, gzip, and Brotli output against a freshly rebuilt historical baseline.
  • Existing exports and original font codepoints verified unchanged.
  • Latest locale-aware lint-plugin suite: 45 tests passed; lint, both typechecks, generated-data freshness, and scoped formatting passed.
  • Normal formatting and commit-message hooks passed.

Notes

Only source-backed locale variants are exported. Full fonts and whole-library imports grow intentionally; use font subsetting to ship only consumed glyphs. No runtime locale detection or automatic selection between distinct directional artwork is introduced.

Generate explicit locale exports and separate SVG, headless, and font atoms,
while preserving existing exports and glyph codepoints.

Cover localized imports in transforms, lint rules, subsetting, and browser
rendering. Keep generator tests and type checking under importer ownership.

Refs microsoft#1258
Generate a compact list of sized system-icon exports without a resizable
counterpart and skip invalid named and namespace suggestions.

Keep brand/custom sources unchanged and exhaustively verify system-icon
targets against metadata. Document the availability-check scope.
Exclude system Light variants from resizable suggestions while retaining
locale-aware classification and suffix-preserving replacements.

Regenerate non-Light exceptions and cover localized Light imports, catalogue
invariants, and unchanged brand/custom behavior.
Resolve conflicts against upstream 1.1.343 and retain its per-export
atomization and async font subsetting behavior.

Preserve published codepoints, reassign only colliding unreleased locale
glyphs, and regenerate fonts, React metadata, and snapshots.

Verify locale selectors, all relevant integrations, and zero named-import
JS/CSS growth against a freshly built current-main baseline.
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

📋 PR Validation Summary

Check the Build react library job summary for detailed reports:

  • 📦 Bundle Size — size comparison against the base branch
  • 📖 Docsite Preview — build artifact with local preview instructions

To view: click the link above → select the Build react library job → open the Summary tab.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It changes shared generation, generated font artifacts, bundler integrations, and lint behavior across multiple packages and requires final human validation.

0 open findings

What changed in this PR

Adds source-backed localized React icon variants across SVG, sprite, headless, and font APIs while preserving existing exports and codepoints.

Changes:

  • Introduces shared locale-aware icon naming, discovery, grouping, and RTL handling.
  • Extends fonts, transforms, subsetting, metadata, and lint suggestions for localized exports.
  • Adds integration tests, bundle checks, and consumer documentation.
File Description
yarn.lock Locks font inspection dependencies.
packages/​react-icons/​scripts/​per-icon.writer.js Groups locale-qualified atoms.
packages/​react-icons/​scripts/​deprecated-atoms.js Handles qualified export names.
packages/​react-icons/​scripts/​convert.utils.test.js Tests localized SVG discovery.
packages/​react-icons/​scripts/​convert.utils.js Generates localized SVG exports.
packages/​react-icons/​scripts/​convert.js Uses recursive source discovery.
packages/​react-icons/​scripts/​convert-font.utils.test.js Tests localized font atoms.
packages/​react-icons/​scripts/​convert-font.utils.js Generates localized font exports.
packages/​react-icons/​scripts/​convert-font.js Applies locale-aware RTL metadata.
packages/​react-icons/​scripts/​check-localized-bundle-size.js Adds named-import size regression checks.
packages/​react-icons/​README.md Documents localized icon APIs.
packages/​react-icons/​project.json Adds inputs and bundle-size target.
packages/​react-icons/​package.json Exposes the bundle-size script.
packages/​react-icons/​fluent-icons-transform.cjs Resolves localized atomic imports.
packages/​react-icons/​docs/​build-transforms.md Documents transform mappings.
packages/​react-icons/​build-verify.test.js Updates generated-output verification.
packages/​react-icons/​build-transforms.test.js Tests localized transform paths.
packages/​react-icons-svg-sprite-subsetting-webpack-plugin/​test/​webpack.config.js Verifies localized sprite subsetting.
packages/​react-icons-svg-sprite-subsetting-webpack-plugin/​test/​src/​merged.js Adds merged localized fixtures.
packages/​react-icons-svg-sprite-subsetting-webpack-plugin/​test/​src/​atomic.js Adds atomic localized fixtures.
packages/​react-icons-svg-sprite-subsetting-webpack-plugin/​test/​__mock__/​react-icons/​lib/​atoms/​svg-sprite/​text-bold_sr-cyrl.svg Adds Serbian sprite fixture.
packages/​react-icons-svg-sprite-subsetting-webpack-plugin/​test/​__mock__/​react-icons/​lib/​atoms/​svg-sprite/​text-bold_sr-cyrl.js Adds Serbian sprite module.
packages/​react-icons-svg-sprite-subsetting-webpack-plugin/​test/​__mock__/​react-icons/​lib/​atoms/​svg-sprite/​text-bold_es.svg Adds Spanish sprite fixture.
packages/​react-icons-svg-sprite-subsetting-webpack-plugin/​test/​__mock__/​react-icons/​lib/​atoms/​svg-sprite/​text-bold_es.js Adds Spanish sprite module.
packages/​react-icons-font-subsetting-webpack-plugin/​test/​src/​localized.js Adds localized font entry fixture.
packages/​react-icons-font-subsetting-webpack-plugin/​test/​make-configs.js Validates selected font glyphs.
packages/​react-icons-font-subsetting-webpack-plugin/​test/​check-localized-font-render.js Adds browser rendering checks.
packages/​react-icons-font-subsetting-webpack-plugin/​README.md Documents rendering validation.
packages/​react-icons-font-subsetting-webpack-plugin/​project.json Adds rendering test target.
packages/​react-icons-font-subsetting-webpack-plugin/​package.json Adds rendering test script.
packages/​react-icons-atomic-webpack-loader/​test/​transform.test.ts Tests localized import rewrites.
packages/​react-icons-atomic-webpack-loader/​test/​selector-protocol.test.ts Tests localized selector families.
packages/​react-icons-atomic-webpack-loader/​src/​selector-protocol.ts Maps qualified export families.
packages/​react-icons-atomic-webpack-loader/​src/​modules.ts Recognizes localized icon names.
packages/​eslint-plugin-react-icons/​src/​rules/​prefer-resizable/​sized-icons.ts Preserves locale-aware suggestions.
packages/​eslint-plugin-react-icons/​src/​rules/​prefer-resizable/​sized-icons.test.ts Tests valid localized counterparts.
packages/​eslint-plugin-react-icons/​src/​rules/​prefer-resizable/​index.ts Tracks each import source.
packages/​eslint-plugin-react-icons/​src/​rules/​prefer-resizable/​index.test.ts Covers localized lint behavior.
packages/​eslint-plugin-react-icons/​src/​rules/​prefer-resizable/​icon-sizes.generated.ts Records missing resizable counterparts.
packages/​eslint-plugin-react-icons/​scripts/​generate-icon-sizes.mjs Generates locale-aware availability data.
packages/​eslint-plugin-react-icons/​docs/​rules/​prefer-resizable.md Documents suggestion policies.
packages/​docsite/​stories/​Icons/​IconsAtomicAPI.mdx Documents localized atom groups.
package.json Adds fontkit test dependencies.
nx.json Tracks the naming utility as input.
importer/​tsconfig.utils.json Type-checks importer utilities.
importer/​project.json Adds importer test configuration.
importer/​package.json Adds importer tests and type-checking.
importer/​icon-name.test.js Tests naming and mirroring rules.
importer/​icon-name.js Centralizes qualified icon naming.
importer/​generateFont.test.js Verifies localized font generation.
importer/​generateFont.js Includes localized glyph sources.
fonts/​FluentSystemIcons-Resizable.json Adds resizable localized codepoints.
fonts/​FluentSystemIcons-Resizable.css Exposes localized resizable glyphs.
fonts/​FluentSystemIcons-Regular.json Adds regular localized codepoints.
fonts/​FluentSystemIcons-Light.json Adds localized light codepoint.
fonts/​FluentSystemIcons-Light.html Updates the light-font preview.
fonts/​FluentSystemIcons-Light.css Exposes the localized light glyph.
fonts/​FluentSystemIcons-Filled.json Adds filled localized codepoints.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Retain upstream dependency upgrades, CODEOWNERS cleanup, and the file-type
icon catalogue while preserving localized icon tooling and font assertions.

Resolve the root manifest/lockfile entries and validate localized inline
sprite checks in the upstream HTML beforeEmit hook.
@Hotell
Martin Hochel (Hotell) marked this pull request as ready for review October 8, 2026 12:40
@Hotell
Martin Hochel (Hotell) requested a review from a team as a code owner October 8, 2026 12:40

@vinguyen12 Vi Nguyen (vinguyen12) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Signed off from Outlook local testing. Thanks for supporting this and also the quick turn around, Martin!

…t-icons

# Conflicts:
#	fonts/FluentSystemIcons-Filled.css
#	fonts/FluentSystemIcons-Filled.json
#	fonts/FluentSystemIcons-Filled.ttf
#	fonts/FluentSystemIcons-Filled.woff
#	fonts/FluentSystemIcons-Filled.woff2
#	fonts/FluentSystemIcons-Regular.css
#	fonts/FluentSystemIcons-Regular.json
#	fonts/FluentSystemIcons-Regular.ttf
#	fonts/FluentSystemIcons-Regular.woff
#	fonts/FluentSystemIcons-Regular.woff2
#	fonts/FluentSystemIcons-Resizable.css
#	fonts/FluentSystemIcons-Resizable.json
#	fonts/FluentSystemIcons-Resizable.ttf
#	fonts/FluentSystemIcons-Resizable.woff
#	fonts/FluentSystemIcons-Resizable.woff2
#	importer/package.json
#	packages/eslint-plugin-react-icons/docs/rules/prefer-resizable.md
#	packages/eslint-plugin-react-icons/scripts/generate-icon-sizes.mjs
#	packages/eslint-plugin-react-icons/src/rules/prefer-resizable/icon-sizes.generated.ts
#	packages/eslint-plugin-react-icons/src/rules/prefer-resizable/index.test.ts
#	packages/eslint-plugin-react-icons/src/rules/prefer-resizable/sized-icons.test.ts
#	packages/eslint-plugin-react-icons/src/rules/prefer-resizable/sized-icons.ts
#	packages/react-icons/build-verify.test.js
- reuse lodash camelCase/kebabCase in importer/icon-name.js
- share ICON_SUFFIX_REGEX between atomic loader modules
- scope icon-name.js to the font generation Nx input
- move contributor bundle-size instructions into the script header
- condense localized-icon docs in README and docsite

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Hotell
Martin Hochel (Hotell) merged commit 463d58b into microsoft:main Oct 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants