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

Add an option to change primary language for a deployment #13

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

Conversation

tnzk
Copy link

@tnzk tnzk commented Oct 11, 2023

Currently, Primo uses English as the primary language (#120). When you have different locales, the root ('/') serves the texts and images for English, and other locales, say German, are served via /de. This can be annoying when you build a site for primarily non-English speakers where you need to use the root for an other language, which forces using another locale to host English version. Visitors for the site will see English in /de or the like.

This PR adds a select box in the "Deploy modal" to choose which language to use as the primary language in the deployment.

スクリーンショット 2023-10-11 15 21 07

It builds the site bundle in which the files in root have the content in the primary language chosen with sub directories any other languages.

$ tree .
.
├── _symbols
│   ├── 2807ecaa-82f5-45dc-ba3f-c9c6d5abfa83.js
│   └── abcbb3c8-27e8-4ee7-9d6f-cdb3f0134289.js
├── edit
│   └── index.html
├── en
│   └── index.html
├── index.html
├── primo.json
└── robots.txt

For simplicity, it just asks the primary language every time you are to deploy. It could be useful if you can choose and persist the primary language as part of metadata, as suggested in #120. It will also enable to follow the setting in the language selector in the editing screen. This will involve a DB migration (adding non-nullable default_locale which defaults to 'en' to sites table), let me know if you find this a good idea to include in this PR.

@mateomorris
Copy link
Contributor

Thank you for this! Definitely would love to implement this functionality ASAP for international users.

One thing I noticed though is that it looks like English and Japanese are static values in the Deployment modal? Is this still a work in progress?

Will review more tomorrow, thanks again!

@tnzk
Copy link
Author

tnzk commented Oct 13, 2023

Thank you for reviewing! I forgot they were yet to be fixed, now I updated it to show languages used in the site as the options.

I also added primary_language as a store, so that users don't have to choose the language every time he/she deploys.

@micahmills
Copy link

Other than the merge conflicts what else needs to be done to get this merged in? I would like this feature and I have some time to help with it.

@ghost
Copy link

ghost commented Sep 26, 2024

I did my best to solve the conflicts. You can find it on https://github.com/Endededed/builder/tree/pr13

Can somebody take a look and approve the merge?

Need this feature in production.

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.

3 participants