-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Drupal locale set via ENV #113
base: main
Are you sure you want to change the base?
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
aa0f5be
to
bc56f15
Compare
WalkthroughThe update introduces the ability to specify the locale for Drupal installation, defaulting to English if not defined. It involves setting up environment variables for the installation profile and locale, and modifying the installation command to utilize these variables. Additionally, the Docker image in the configuration is updated to the latest version, ensuring the use of the most recent environment for Drupal development. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Files selected for processing (1)
- .gitpod/drupal/drupalpod-setup.sh (2 hunks)
Additional comments (Suppressed): 1
.gitpod/drupal/drupalpod-setup.sh (1)
- 19-19: The environment variable
DP_INSTALL_PROFILE
is being set to 'en' which seems to be a locale code. This might be a typo and should probably beDP_INSTALL_LOCALE
. Please verify.- export DP_INSTALL_PROFILE=en + export DP_INSTALL_LOCALE=en
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Files selected for processing (1)
- .gitpod/drupal/drupalpod-setup.sh (2 hunks)
Additional comments (Suppressed): 1
.gitpod/drupal/drupalpod-setup.sh (1)
- 321-321: The
ddev drush si
command has been updated to include the--locale
option. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.
Rate Limit ExceededYou have exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 29 minutes and 59 seconds before requesting another review. To re-trigger a review, convert this PR to a draft and then mark it as ready for review again. Alternatively, you can push a new commit to this PR. |
* ⏫ Gitpod uses "latest"
e5a864f
to
c6238e9
Compare
Reset / rebase on main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (2)
- .gitpod.yml (1 hunks)
- .gitpod/drupal/drupalpod-setup/drupalpod-setup.sh (2 hunks)
Files skipped from review due to trivial changes (1)
- .gitpod.yml
Additional comments: 1
.gitpod/drupal/drupalpod-setup/drupalpod-setup.sh (1)
- 21-21: The addition of the
DP_INSTALL_LOCALE
environment variable initialization with a null default value is a good practice. It ensures that if the variable is not explicitly set, it won't cause any unexpected behavior in the script. This change aligns with the PR's objective to allow users to specify the installation locale.
@@ -136,8 +137,7 @@ GITMODULESEND | |||
# ddev config auto updates settings.php and generates settings.ddev.php | |||
ddev config --auto | |||
# New site install | |||
time ddev drush si -y --account-pass=admin --site-name="DrupalPod" "$DP_INSTALL_PROFILE" | |||
|
|||
time ddev drush si -y --account-pass=admin --site-name="DrupalPod" "$DP_INSTALL_PROFILE" --locale="${DP_INSTALL_LOCALE:-en}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modification to the ddev drush si
command to include the --locale
option, dynamically set to ${DP_INSTALL_LOCALE:-en}
, effectively addresses the PR's objective. This change allows the installation locale to be specified via an environment variable, with a fallback to English if the variable is not set. It's a clear and concise way to implement this feature. However, it's important to ensure that all possible values for DP_INSTALL_LOCALE
are valid Drupal locales. Additionally, consider documenting this environment variable and its usage for future users or developers.
Would you like assistance in documenting the DP_INSTALL_LOCALE
variable usage in the project's README or developer documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please assist in documenting the DP_INSTALL_LOCALE variable usage in the project's README or developer documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tyler36, based on the search results, it seems the most appropriate place to document the DP_INSTALL_LOCALE
variable usage would be in the README.md
file, as it's the central place for project documentation. Here's a draft for the documentation section:
### Setting the Installation Locale
DrupalPod allows you to specify the installation locale for Drupal via the `DP_INSTALL_LOCALE` environment variable. This can be particularly useful for users who wish to install Drupal in a language other than English.
To set the installation locale, define the `DP_INSTALL_LOCALE` environment variable in your environment. For example, to install Drupal in French, you would set the variable as follows:
```bash
export DP_INSTALL_LOCALE="fr"
If DP_INSTALL_LOCALE
is not set, the installation will default to English (en
). This feature ensures that DrupalPod can be easily customized to meet the needs of a diverse user base.
This section can be added to the `README.md` file under a suitable heading, such as "Configuration" or "Usage". Would you like this to be placed under a specific section, or do you have any modifications in mind?
<details>
<summary>Analysis chain</summary>
</details>
<details>
<summary>Scripts executed</summary>
The following scripts were executed for the analysis:
---
Script:
```shell
#!/bin/bash
# Search for README.md or other documentation files
fd -e md -e txt -e rst
Length of output: 171
The Problem/Issue/Bug
Drupal defaults to English locale.
How this PR Solves The Problem
This PR allows the user to set Drupal's locale via an ENV.
drush si
is run with the locale being set toDP_INSTALL_LOCALE
.DP_INSTALL_LOCALE
defaults to English(`en') if not set.No attempts are made to validate the locale code passed to drush.
Manual Testing Instructions
Ideally, we should be able to pass the variable via the URL similar to
DP_INSTALL_PROFILE
.I'm sure if its that simple though.
Ideally, the browser extension would be updated to allow user to enter/select the locale. However, having it as a "undocumented" feature is fine until "full" support is required.
Related Issue Link(s)
Release/Deployment notes
Summary by CodeRabbit
DP_INSTALL_LOCALE
environment variable, defaulting to "en" if not specified.