Skip to content

fix: improve lingui configuration - #1388

Merged
Mythie merged 6 commits into
mainfrom
fix/improve-lingui-configuration
Oct 9, 2024
Merged

Mythie merged 6 commits into
mainfrom
fix/improve-lingui-configuration

Conversation

@dguyen

@dguyen dguyen commented Oct 8, 2024 •

Copy link
Copy Markdown
Collaborator

Description

Currently merge conflicts arise due to the compiled JS and PO translation files.

This PR is a rework on how we handle extracting and compiling translations to streamline PRs and merging branches.

Changes Made

  • Remove compiled translation files from being committed
  • Extract and compile translations only on build
  • Extract will still occur when commits land on main to sync and pull new translations with Crowdin

Summary by CodeRabbit

  • New Features
    • Introduced new tasks for translation extraction and compilation in the build process.
  • Bug Fixes
    • Streamlined translation extraction and compilation workflows to improve efficiency.
  • Chores
    • Removed outdated translation extraction commands from pre-commit hooks.
    • Added a new .gitignore file to manage ignored files in translations.
  • Documentation
    • Updated dynamic import paths for translations based on environment and context.
  • Revert
    • Removed multiple translation files for various languages, affecting localized content availability.

@vercel

vercel Bot commented Oct 8, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
prd-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:27am
stg-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:27am
stg-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:27am
stg-marketing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:27am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
prd-app ⬜️ Ignored (Inspect) Oct 9, 2024 3:27am
prd-marketing ⬜️ Ignored (Inspect) Oct 9, 2024 3:27am

@coderabbitai

coderabbitai Bot commented Oct 8, 2024 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request involve the removal and modification of translation management workflows and scripts within the repository. The .github/workflows/translations-extract.yml file has been deleted, while the .github/workflows/translations-upload.yml file has been updated to refine the translation extraction and compilation steps. The pre-commit hook has been modified to exclude translation tasks. Additionally, the package.json files for both the @documenso/marketing and @documenso/web projects have been updated to include translation commands in their build processes. Several translation files have been removed, affecting localization support.

Changes

File Path Change Summary
.github/workflows/translations-extract.yml Deleted: workflow for extracting and compiling translations.
.github/workflows/translations-upload.yml Updated: split translation extraction and compilation into separate steps; adjusted commit logic.
.husky/pre-commit Modified: removed translation extraction and compilation commands; retained file copying and linting.
apps/marketing/package.json Updated: build script now includes turbo run translate:extract and turbo run translate:compile.
apps/web/package.json Updated: build script now includes turbo run translate:extract and turbo run translate:compile.
packages/lib/client-only/providers/i18n.server.tsx Modified: loadCatalog function now determines file extension based on NODE_ENV and context.
packages/lib/translations/.gitignore Added: new file to ignore compiled JavaScript translation files.
packages/lib/translations/de/marketing.js Deleted: module for German marketing translations.
packages/lib/translations/de/web.js Deleted: module for German web translations.
packages/lib/translations/en/marketing.js Deleted: module for English marketing translations.
packages/lib/translations/en/web.js Deleted: module for English web translations.
packages/lib/translations/fr/marketing.js Deleted: module for French marketing translations.
packages/lib/translations/fr/web.js Deleted: module for French web translations.
packages/lib/translations/ro/marketing.js Deleted: module for Romanian marketing translations.
packages/lib/translations/ro/web.js Deleted: module for Romanian web translations.
packages/lib/utils/i18n.ts Modified: dynamicActivate function updated for dynamic import paths based on environment and context.
turbo.json Updated: added new task translate:extract to the pipeline configuration.

Possibly related PRs

Suggested labels

pkg: ee changes, 🚨 migrations 🚨

Suggested reviewers

  • dguyen
  • ephraimduncan

Poem

🐰 In the fields where translations bloom,
A workflow's gone, making room.
With scripts that build and messages clear,
Our app speaks well, for all to hear!
So hop along, let changes sprout,
Localization’s what it’s all about! 🌼


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions

github-actions Bot commented Oct 8, 2024 •

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions for pull request titles! 💚🚀

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
apps/marketing/package.json (2)

8-8: Approve changes to build script with considerations

The modification to the build script aligns well with the PR objectives by integrating translation extraction and compilation into the build process. This change should help prevent merge conflicts caused by compiled translation files and ensure that the latest translations are always included in the build.

However, please consider the following impacts:

  1. The build time may increase due to the additional translation steps.
  2. CI/CD pipelines may need to be updated to ensure they have the necessary dependencies for translation tasks.
  3. Developers should be informed that translations are now handled during the build process, not separately.

To mitigate potential issues:

  • Consider caching translation artifacts in CI/CD pipelines to improve build times.
  • Update documentation to reflect this new build process for the marketing app.
  • Ensure that all necessary translation dependencies are correctly specified in the project.

Compiled Translation Files Still Present in Repository

Several .po files remain in the repository and .gitignore does not exclude them. Please remove these files from version control and update .gitignore to prevent future commits of compiled translation files.

  • Files to Remove:

    • packages/lib/translations/de/common.po
    • packages/lib/translations/de/marketing.po
    • packages/lib/translations/de/web.po
    • packages/lib/translations/en/common.po
    • packages/lib/translations/en/marketing.po
    • packages/lib/translations/en/web.po
    • packages/lib/translations/fr/common.po
    • packages/lib/translations/fr/marketing.po
    • packages/lib/translations/fr/web.po
    • packages/lib/translations/ro/common.po
    • packages/lib/translations/ro/marketing.po
    • packages/lib/translations/ro/web.po
  • Update .gitignore:

    /packages/lib/translations/**/*.po
🔗 Analysis chain

Line range hint 1-55: Verify removal of compiled translation files from version control

While the changes to the build script address part of the PR objectives, it's important to ensure that compiled translation files are no longer being committed to the repository.

Let's verify this by checking for any lingering translation files that should be removed or added to .gitignore:

Please review the results of this script and ensure that:

  1. No compiled JS translation files are present in the locale directories.
  2. The .gitignore file has been updated to exclude compiled translation files.
  3. Any .po files that should not be in version control have been removed.

If any issues are found, please update the PR to address them.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for compiled translation files that might need to be removed or ignored

# Test 1: Look for .js translation files in the locale directories
echo "Checking for compiled JS translation files:"
fd -e js -p 'locale/.*\.js$'

# Test 2: Check if .gitignore has been updated to exclude compiled translation files
echo "Checking .gitignore for translation file exclusions:"
grep -E '(locale/.*\.js|.*\.po)' .gitignore

# Test 3: Look for .po files that might need to be removed
echo "Checking for .po files:"
fd -e po

Length of output: 824

.github/workflows/translations-upload.yml (1)

Line range hint 41-44: LGTM: Improved error handling for compilation step.

The addition of the id and continue-on-error flags enhances the workflow's robustness. This change allows the workflow to proceed even if compilation fails, which is then used to trigger the upload of missing translations.

Consider adding a comment explaining why we allow this step to fail and continue. This would improve the workflow's maintainability.

🧰 Tools
🪛 actionlint

26-26: description is required in metadata of "Setup node and cache node_modules" action at "/cache/22/14bd4d0c-589d-41e8-9ea7-a24bb36527ee/home/jailuser/git/.github/actions/node-install/action.yml"

(action)

packages/lib/utils/i18n.ts (1)

13-13: Consider adding error handling for dynamic import.

While the dynamic import is more flexible, it might benefit from error handling to gracefully manage cases where the translation file is missing or fails to load.

Consider wrapping the import in a try-catch block:

-  const { messages } = await import(`../translations/${locale}/${context}.${extension}`);
+  try {
+    const { messages } = await import(`../translations/${locale}/${context}.${extension}`);
+    i18nInstance.loadAndActivate({ locale, messages });
+  } catch (error) {
+    console.error(`Failed to load translations for ${locale}/${context}.${extension}:`, error);
+    // Fallback behavior, e.g., load default language or show an error message
+  }

-  i18nInstance.loadAndActivate({ locale, messages });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 64ea4a6 and a900495.

📒 Files selected for processing (17)
  • .github/workflows/translations-extract.yml (0 hunks)
  • .github/workflows/translations-upload.yml (1 hunks)
  • .husky/pre-commit (0 hunks)
  • apps/marketing/package.json (1 hunks)
  • apps/web/package.json (1 hunks)
  • packages/lib/client-only/providers/i18n.server.tsx (1 hunks)
  • packages/lib/translations/.gitignore (1 hunks)
  • packages/lib/translations/de/marketing.js (0 hunks)
  • packages/lib/translations/de/web.js (0 hunks)
  • packages/lib/translations/en/marketing.js (0 hunks)
  • packages/lib/translations/en/web.js (0 hunks)
  • packages/lib/translations/fr/marketing.js (0 hunks)
  • packages/lib/translations/fr/web.js (0 hunks)
  • packages/lib/translations/ro/marketing.js (0 hunks)
  • packages/lib/translations/ro/web.js (0 hunks)
  • packages/lib/utils/i18n.ts (1 hunks)
  • turbo.json (2 hunks)
💤 Files with no reviewable changes (10)
  • .github/workflows/translations-extract.yml
  • .husky/pre-commit
  • packages/lib/translations/de/marketing.js
  • packages/lib/translations/de/web.js
  • packages/lib/translations/en/marketing.js
  • packages/lib/translations/en/web.js
  • packages/lib/translations/fr/marketing.js
  • packages/lib/translations/fr/web.js
  • packages/lib/translations/ro/marketing.js
  • packages/lib/translations/ro/web.js
✅ Files skipped from review due to trivial changes (1)
  • packages/lib/translations/.gitignore
🧰 Additional context used
🔇 Additional comments (12)
.github/workflows/translations-upload.yml (2)

28-29: LGTM: New step for extracting translations.

This new step aligns with the PR objective of modifying the workflow for translation extraction. The command npm run translate:extract is clear and concise, focusing solely on the extraction process.


Line range hint 1-62: Summary: Workflow improvements align well with PR objectives.

The changes to this workflow file effectively address the PR's goals:

  1. Extraction and compilation steps are now separate, allowing for more granular control.
  2. The compilation step can now fail without stopping the entire workflow, enabling the upload of missing translations when needed.
  3. These changes should help reduce merge conflicts related to compiled translation files.

Overall, these modifications improve the flexibility and robustness of the translation management process.

🧰 Tools
🪛 actionlint

26-26: description is required in metadata of "Setup node and cache node_modules" action at "/cache/22/14bd4d0c-589d-41e8-9ea7-a24bb36527ee/home/jailuser/git/.github/actions/node-install/action.yml"

(action)

packages/lib/client-only/providers/i18n.server.tsx (4)

18-18: Approve dynamic file extension determination

The use of different file extensions for development and production environments is a good practice. It allows for easier debugging in development (using .po files) while optimizing for performance in production (using compiled .js files).


21-21: Approve updated import statement

The new import statement correctly uses the dynamically determined extension and context variables. This change supports the PR objective of improving the translation configuration and should reduce merge conflicts by eliminating the need to commit compiled translation files.


18-21: Verify build process compatibility

The changes to the loadCatalog function align well with the PR objectives of improving the translation configuration and reducing merge conflicts. The dynamic file extension and context determination should make the code more flexible and environment-aware.

To ensure full compatibility:

  1. Verify that the build process generates the necessary .js files for production use.
  2. Confirm that the IS_APP_WEB constant is consistently used across the codebase for context determination.
  3. Test the translation loading in both development and production environments to ensure smooth functionality.

Let's check the build scripts for translation compilation:

#!/bin/bash
# Description: Check build scripts for translation compilation

# Test: Search for translation-related build commands in package.json files
rg --type json 'build.*lingui' packages/*/package.json

19-19: Verify the impact of context determination

The introduction of the context variable based on IS_APP_WEB aligns with the PR objective of improving the configuration. However, we should ensure that this change is consistent across the codebase.

Let's verify the usage of IS_APP_WEB:

✅ Verification successful

Translation scripts are properly defined

The "translate:extract" and "translate:compile" scripts are present in both turbo.json and the relevant package.json files, ensuring they are correctly set up for the build process.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of translation scripts in Turborepo configuration

# Test: Search for translate:extract and translate:compile in turbo.json files
echo "Searching for translation scripts in turbo.json files:"
fd turbo.json --exec grep -H -E "translate:(extract|compile)"

# Test: Search for translate:extract and translate:compile in package.json files
echo "Searching for translation scripts in package.json files:"
fd package.json --exec grep -H -E '"translate:(extract|compile)"'

Length of output: 822

packages/lib/utils/i18n.ts (2)

10-13: Improved flexibility in translation file handling.

The changes to the dynamicActivate function enhance the flexibility of handling translation files:

  1. The extension variable allows for different file types in development (.po) and production (.js) environments.
  2. The context variable separates translations for web and marketing, aligning with the application structure.
  3. The dynamic import path construction supports the PR's objective of modifying the translation workflow.

These improvements should help reduce merge conflicts and streamline the translation process as intended.


Line range hint 1-114: Summary: Changes align well with PR objectives

The modifications to the dynamicActivate function in this file support the PR's goal of improving the lingui configuration and reducing merge conflicts. By dynamically determining the file extension and context, the changes allow for a more flexible handling of translation files during different stages of development and deployment.

These changes, combined with the removal of compiled translation files from the repository (as mentioned in the PR objectives), should help streamline the translation workflow and reduce the likelihood of merge conflicts.

To ensure the full success of these changes:

  1. Verify that the build process correctly generates both .po and .js translation files.
  2. Consider implementing error handling for the dynamic import to gracefully manage potential issues.
  3. Update any related documentation or team guidelines to reflect the new translation file handling process.
turbo.json (2)

37-39: LGTM: Addition of translate:extract task aligns with PR objectives.

The new translate:extract task with cache: false is a good addition that aligns with the PR objectives. This configuration ensures that translation extraction will always run during the build process, without relying on cached results. This change supports the goal of moving translation extraction out of the commit process and into the build process, which should help reduce merge conflicts related to compiled translation files.


Line range hint 1-139: Verify integration with existing pipeline tasks.

The addition of the translate:extract task looks good. To ensure smooth integration with the existing build process, please verify:

  1. If any existing tasks (e.g., build, prebuild) need to depend on translate:extract.
  2. If translate:compile should depend on translate:extract.
  3. Whether any changes are needed in the globalDependencies or globalEnv sections to support the new translation extraction process.

This verification will help ensure that the new translation workflow integrates seamlessly with the existing build pipeline.

Comment on lines +10 to +13
const extension = process.env.NODE_ENV === 'development' ? 'po' : 'js';
const context = IS_APP_WEB ? 'web' : 'marketing';

const { messages } = await import(`../translations/${locale}/${context}.${extension}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Missing .js Translation Files in Production

The build process does not generate .js translation files as expected for production.

  • No .js files found in packages/lib/translations.
🔗 Analysis chain

Verify the existence of both .po and .js translation files.

The new implementation assumes the existence of both .po and .js translation files. It's crucial to ensure that the build process generates both file types as expected.

Let's verify the existence of these files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for the existence of .po and .js translation files

# Test: Check for .po files in development context
echo "Checking for .po files:"
fd -e po . packages/lib/translations

# Test: Check for .js files in production context
echo "Checking for .js files:"
fd -e js . packages/lib/translations

# Note: If either command returns no results, it might indicate a potential issue with the translation file generation process.

Length of output: 659

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
docker/Dockerfile (1)

Incomplete Lingui Workflow Implementation

The lingui.config.js file is referenced in the docker/Dockerfile but is not found in the repository. Please ensure that the configuration file is added to the appropriate directory or generated during the build process to fully implement the Lingui workflow.

  • Verify the presence of lingui.config.js in the repository.
  • Ensure that the build process correctly generates or includes lingui.config.js if it’s intended to be created dynamically.
🔗 Analysis chain

Line range hint 1-124: Verify complete implementation of new lingui workflow

The addition of the lingui.config.js file to the installer stage is a good start. However, to ensure that the new lingui workflow is fully implemented, it might be worth verifying if any other stages or commands in the Dockerfile need to be updated.

For example:

  1. Are there any lingui-related commands that need to be added to the build process?
  2. Does the runner stage need any additional files or configurations related to lingui?

To help with this verification, you can run the following script:

This script will help identify any existing lingui-related commands in the Dockerfile and npm scripts in package.json files, which can guide further modifications if needed.


To address the issues encountered, please run the following script to accurately search for lingui-related commands and handle any malformed package.json files:

shell
#!/bin/bash

Description: Improved script to check for lingui-related commands and handle malformed package.json files

Search for lingui-related commands in the Dockerfile

echo "Searching for lingui-related commands in Dockerfile:"
rg 'lingui|translation' Dockerfile

echo ""

Find all package.json files

echo "Finding all package.json files:"
PACKAGE_JSON_FILES=$(fd package.json)
echo "$PACKAGE_JSON_FILES"
echo ""

Iterate over each package.json file to check for lingui-related scripts

echo "Checking for lingui-related npm scripts:"
for file in $PACKAGE_JSON_FILES; do
echo "Inspecting $file:"
jq -e '.scripts | to_entries[] | select(.key | contains("lingui") or contains("translation")) | "(.key): (.value)"' "$file" 2>/dev/null
if [ $? -ne 0 ]; then
echo " Error: Malformed JSON in $file"
fi
echo ""
done


To further verify the complete implementation of the lingui workflow and ensure all related configurations are correctly set up, please run the following script:

This script performs the following actions:

  1. Validates all package.json files to ensure there are no malformed JSON files that could interfere with script execution.
  2. Searches for lingui-related dependencies in both dependencies and devDependencies sections of each package.json.
  3. Checks for the existence of lingui.config.js in the repository root, which is essential for the lingui workflow.
  4. Looks for any lingui-related commands or configurations in the Dockerfile and other configuration files (e.g., *.config.js).

By running this script, you will obtain detailed information about the presence and correct setup of the lingui workflow within the codebase.


To address the issues encountered in the previous script, please run the following revised script. This script corrects the search paths and ensures comprehensive verification of the lingui workflow implementation:

Explanation of the Revised Script:

  1. Validation of package.json Files:

    • Ensures all package.json files are well-formed JSON.
  2. Search for Lingui-Related Dependencies:

    • Looks for any dependencies or devDependencies that include "lingui" in their names across all package.json files.
  3. Check for lingui.config.js:

    • Specifies potential locations where lingui.config.js might reside, such as the repository root, apps/web/, or packages/ui/.
    • Reports the presence or absence of the configuration file in each location.
  4. Search for Lingui-Related Commands in Configuration Files:

    • Correctly targets docker/Dockerfile to search for lingui-related commands.
    • Recursively searches all .config.js files for any mentions of "lingui" or "translation".

By running this revised script, you will obtain more accurate and comprehensive information regarding the implementation and configuration of the lingui workflow within the codebase. This will help in determining whether the initial review comment's concerns are fully addressed or if further modifications are necessary.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for lingui-related commands and configurations in the Dockerfile

# Search for lingui-related commands in the Dockerfile
echo "Searching for lingui-related commands:"
rg --type dockerfile 'lingui|translation' docker/Dockerfile

# Check if there are any lingui-related npm scripts in package.json files
echo "Checking for lingui-related npm scripts:"
fd package.json | xargs jq -r '.scripts | to_entries[] | select(.key | contains("lingui") or contains("translation")) | "\(.key): \(.value)"'

Length of output: 489


Script:

# 

Length of output: 0


Script:

# 
#!/bin/bash
# Description: Comprehensive script to verify lingui workflow implementation

echo "### Validating all package.json files ###"
# Find and validate all package.json files
PACKAGE_JSON_FILES=$(fd package.json)
for file in $PACKAGE_JSON_FILES; do
  echo "Validating $file:"
  if jq empty "$file" 2>/dev/null; then
    echo "  - Valid JSON."
  else
    echo "  - Error: Malformed JSON in $file"
  fi
done

echo ""
echo "### Searching for lingui-related dependencies in package.json ###"
# Search for lingui dependencies
for file in $PACKAGE_JSON_FILES; do
  echo "Checking $file for lingui dependencies:"
  jq -r '.dependencies, .devDependencies | to_entries[] | select(.key | contains("lingui")) | "\(.key): \(.value)"' "$file" 2>/dev/null || echo "  - No lingui dependencies found or unable to parse."
done

echo ""
echo "### Checking for lingui.config.js ###"
# Check for the existence of lingui.config.js
if [ -f "lingui.config.js" ]; then
  echo "lingui.config.js found in the repository root."
else
  echo "lingui.config.js not found in the repository root."
fi

echo ""
echo "### Searching for lingui-related commands in Dockerfile and other configuration files ###"
# Search for lingui-related commands in Dockerfile and other relevant files
rg 'lingui|translation' Dockerfile
rg 'lingui|translation' *.config.js

Length of output: 11592


Script:

# 
#!/bin/bash
# Description: Revised comprehensive script to verify lingui workflow implementation with corrected paths

echo "### Validating all package.json files ###"
# Find and validate all package.json files
PACKAGE_JSON_FILES=$(fd package.json)
for file in $PACKAGE_JSON_FILES; do
  echo "Validating $file:"
  if jq empty "$file" 2>/dev/null; then
    echo "  - Valid JSON."
  else
    echo "  - Error: Malformed JSON in $file"
  fi
done

echo ""
echo "### Searching for lingui-related dependencies in package.json ###"
# Search for lingui dependencies
for file in $PACKAGE_JSON_FILES; do
  echo "Checking $file for lingui dependencies:"
  jq -r '.dependencies, .devDependencies | to_entries[] | select(.key | contains("lingui")) | "\(.key): \(.value)"' "$file" 2>/dev/null || echo "  - No lingui dependencies found or unable to parse."
done

echo ""
echo "### Checking for lingui.config.js ###"
# Define potential locations for lingui.config.js
POTENTIAL_CONFIG_LOCATIONS=("lingui.config.js" "apps/web/lingui.config.js" "packages/ui/lingui.config.js")

for config_path in "${POTENTIAL_CONFIG_LOCATIONS[@]}"; do
  if [ -f "$config_path" ]; then
    echo "$config_path found."
  else
    echo "$config_path not found."
  fi
done

echo ""
echo "### Searching for lingui-related commands in Dockerfile and other configuration files ###"
# Search for lingui-related commands in the correct Dockerfile path
echo "Searching in docker/Dockerfile:"
rg 'lingui|translation' docker/Dockerfile || echo "  - No lingui-related commands found in docker/Dockerfile."

echo ""

# Recursively search for lingui-related commands in all .config.js files
echo "Searching in all .config.js files:"
rg 'lingui|translation' --glob '*.config.js' || echo "  - No lingui-related commands found in .config.js files."

Length of output: 12483

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a900495 and 2f4506e.

📒 Files selected for processing (1)
  • docker/Dockerfile (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
docker/Dockerfile (1)

61-62: LGTM: Appropriate addition of lingui configuration

The addition of these lines to copy the lingui.config.js file from the builder stage to the installer stage is a good change. This ensures that the lingui configuration is available during the build process, which is crucial for the new workflow of handling translations as described in the PR objectives.

This change aligns well with the goal of improving the lingui configuration and modifying the translation extraction and compilation process.

Mythie
Mythie previously approved these changes Oct 9, 2024

This branch was successfully deployed

4 active deployments
Preview – stg-marketing — f5ec9e79 Deployed Oct 9, 2024 by vercel[bot]
Preview – prd-docs — f5ec9e79 Deployed Oct 9, 2024 by vercel[bot]
Preview – stg-docs — f5ec9e79 Deployed Oct 9, 2024 by vercel[bot]
Preview – stg-app — f5ec9e79 Deployed Oct 9, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps: web Issues related to the webapp version bump 👀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants