Skip to content

add locale configuration for docx export #1937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Ovgodd
Copy link

@Ovgodd Ovgodd commented Aug 12, 2025

Title
Add configurable locale for DOCX export (default: en-US)

Description
This PR introduces the ability to configure the default language of the generated .docx files via a new optional locale parameter in createDefaultDocumentOptions.

issue 1896

Details

  • Added locale?: string parameter to allow consumers of the library to set the document’s default language in the styles.xml metadata (<w:lang w:val="..."/>).
  • If no locale is provided, the default is set to en-US.
  • This change improves accessibility: screen readers rely on the document’s language metadata to pronounce words correctly.
  • Implementation replaces the existing language in styles.xml while preserving other attributes.

Example usage

const exporter = new DOCXExporter(schema, mappings);
await exporter.toBlob(blocks, { locale: "fr-FR" });

allows setting the default language in generated .docx files
Copy link

vercel bot commented Aug 12, 2025

@Ovgodd is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

add test cases to ensure the locale option correctly updates default
language in generated .docx files and defaults to en-US when omitted
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.

1 participant