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

Document suggested way of changing the default language #688

Open
bmunslow opened this issue Jul 15, 2024 · 4 comments
Open

Document suggested way of changing the default language #688

bmunslow opened this issue Jul 15, 2024 · 4 comments
Assignees

Comments

@bmunslow
Copy link
Contributor

This starter ships with English as the default language and two additional languages to enable translations.

How do you go about it when the project has a single language, other than English? Or perhaps when the project has several languages but none of them is English?

Since changing the default language in Drupal is no easy job, I was wondering if this process could be documented in the readme file.

@isalmanhaider
Copy link

drush site:install --locale=ar

or

one solution could be utilising https://www.drupal.org/project/drush_language

drush language:add ar
drush language:default ar

@bmunslow
Copy link
Contributor Author

Thanks for the suggestion @isalmanhaider. The only drawback of your solution is it prevents setting up the site with the existing config, which is the whole point of using this Drupal starter.

These are the steps I had to take in a recent project to set Spanish as the default language:

  • Start project as usual
  • Delete unwanted languages in /admin/config/regional/language
  • Set desired language as default (in this case, Spanish)
  • Export config (ddev drush cex)
  • Find and replace string "langcode: en" with "langcode: es" in the following folders:
    • config/sync
    • web/modules/custom/server_default_content
  • Restart project (ddev restart)

No issues found for the time being. This approach doesn't take into account existing config for Solr setup which is tailored for English language.

@mariano-dagostino
Copy link
Collaborator

@bmunslow thanks for the description. Maybe there is a way to automate this. Please review #704 when you have some time.

@bmunslow
Copy link
Contributor Author

Hi @mariano-dagostino thanks a lot for looking into this! I tried your script and it seems to work very well on a clean install. Selected language is indeed set as default and all config and content are correctly set. It looks from the comments in the PR, though, that this will remain as a experimental feature for the time being. In any case, it's great to have your script hanging around and I will very likely use it, thanks again!

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

No branches or pull requests

4 participants