Skip to content
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

Pagefind UI: Option to set UI language #593

Open
marchof opened this issue Apr 8, 2024 · 2 comments
Open

Pagefind UI: Option to set UI language #593

marchof opened this issue Apr 8, 2024 · 2 comments
Labels
improvement Not a bug Pagefind UI The prebuilt Pagefind UI components

Comments

@marchof
Copy link

marchof commented Apr 8, 2024

First of thanks for providing this fantastic tool! We use it for an internal knowledge base project. Integration into the publishing process via GitHub actions just works and the usability for the users is great.

We have a minor enhancement request (not a blocker at all for us):

Scenario

The project hast content in different languages which is all indexed in english (force_language). So you can easily search across all languages (or use filters to select pages of a specific language). Beside the actual content rendered pages have several site tools (including search). The UI of those tools is always in english (regardless of the page content).

Current Behavior

The pagefind UI automatically adjust its UI language to the language of the page as given in the HTML header.

Enhancement Request

Specify a configuration option to set the UI language to a specific language

Possible Workarounds

  • Re-specify all english texts with the translation option.
  • Always specify english in HTML header
@bglw bglw added improvement Not a bug Pagefind UI The prebuilt Pagefind UI components labels Apr 9, 2024
@bglw
Copy link
Contributor

bglw commented Apr 9, 2024

Nice suggestion! It's an easy addition so I'll make sure to sweep it in whenever the next release is going out :)

@bglw
Copy link
Contributor

bglw commented Apr 9, 2024

Another workaround for now if it helps:

Pagefind doesn't watch this attribute at all, so you can quickly change it out while initializing the PagefindUI:

let actualLang = document.documentElement.lang;
document.documentElement.lang = "en";
new PagefindUI({ /* ...options */ });
document.documentElement.lang = actualLang; 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Not a bug Pagefind UI The prebuilt Pagefind UI components
Projects
None yet
Development

No branches or pull requests

2 participants