Skip to content

feat: initial i18n marketing implementation - #1223

Merged
dguyen merged 28 commits into
mainfrom
feat/i18n-marketing
Jul 26, 2024
Merged

dguyen merged 28 commits into
mainfrom
feat/i18n-marketing

Conversation

@dguyen

@dguyen dguyen commented Jul 9, 2024 •

Copy link
Copy Markdown
Collaborator

Description

This PR introduces an initial i18n implementation using Lingui.

We plan to combine it with Crowdin which will provide AI translations when PRs are merged into main.

We plan to rollout i18n to only marketing for now, and will review how everything goes before continuing to introduce it into the main application.

Reasoning

Why not use i18n-next or other alternatives?

To hopefully provide the best DX we chose Lingui because it allows us to simply wrap text that we want to translate in tags, instead of forcing users to do things such as:

  • Update the text to t('some-text')
  • Extract it to the file
  • The text becomes a bit unreadable unless done correctly

Yes, plugins such as i18n-ally and Sherlock exist to simplify these chores, but these require the user to be correctly setup in vscode, and it also does not seem to provide the required configurations for our multi app and multi UI package setup.

Super simple demo

// Before
<p>Text to update</p>

// After
<p>
  <Trans>Text to update</Trans>
</p>

Related Issue

Relates to #885 but is only for marketing for now.

Another branch is slowly being prepared for the changes required for the web application while we wait to see how this goes for marketing.

Changes Made

Our configuration does not follow the general standard since we have translations that cross:

  • Web app
  • Marketing app
  • Constants package
  • UI package

This means we want to separate translations into:

  1. Marketing - Only translations extracted from apps/marketing
  2. Web - Only translations extracted from apps/web
  3. Common - Translations from packages/constants and packages/ui

Then we bundle, compile and minify the translations for production as follows:

  1. Marketing = Marketing + Common
  2. Web = Web + Common

This allows us to only load the required translations when running each application.

Overall general changes:

  • Add i18n to marketing
  • Add core i18n setup to web
  • Add pre-commit hook and GH action to extract any new tags into the translation files

Summary by CodeRabbit

  • New Features

    • Added Romanian localization for marketing messages to improve accessibility for Romanian-speaking users.
    • Introduced German and English translation modules and PO files to enhance the application's internationalization capabilities.
    • Integrated internationalization support in the RootLayout component for dynamic language settings based on server-side configurations.
    • Enhanced the Enterprise component with translation support to adapt to user language preferences.
    • Added a <meta> tag to prevent Google from translating the page content, supporting internationalization efforts.
  • Bug Fixes

    • Resolved minor issues related to the structure and accessibility of translation files.
  • Chores

    • Updated project dependencies to support the new localization features and ensure stability.

@vercel

vercel Bot commented Jul 9, 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 Jul 26, 2024 4:54am
stg-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 26, 2024 4:54am
stg-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 26, 2024 4:54am
stg-marketing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 26, 2024 4:54am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
prd-app ⬜️ Ignored (Inspect) Jul 26, 2024 4:54am
prd-marketing ⬜️ Ignored (Inspect) Jul 26, 2024 4:54am

@coderabbitai

coderabbitai Bot commented Jul 9, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

This update significantly enhances internationalization (i18n) for the application by introducing translation files and modules for marketing content in multiple languages, including Romanian and German. The changes improve accessibility and user experience, enabling tailored marketing messages for users based on their language preferences. Additionally, the layout component now dynamically manages language settings, enriching the application's global reach and engagement.

Changes

File(s) Change Summary
packages/lib/translations/ro/marketing.js, packages/lib/translations/ro/marketing.po, packages/lib/translations/de/marketing.js, packages/lib/translations/de/marketing.po, packages/lib/translations/en/marketing.js, packages/lib/translations/en/marketing.po Introduced new modules and PO files for localized marketing messages in Romanian, German, and English, enhancing accessibility for users in these languages.
apps/marketing/src/app/layout.tsx Enhanced internationalization support by integrating I18nClientProvider and setupI18nSSR, allowing dynamic language management for improved localization.
.eslintrc.cjs, .github/workflows/*.yml, .husky/pre-commit, .prettierignore Minor updates related to linting, GitHub workflows, and pre-commit hooks, improving overall code quality and localization management.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MarketingModule
    participant TranslationProvider

    User->>MarketingModule: Request marketing content
    MarketingModule->>TranslationProvider: Retrieve localized messages
    TranslationProvider-->>MarketingModule: Return localized translations
    MarketingModule-->>User: Display localized marketing content
Loading

🐰 In fields of data, translations grow,
A rabbit hops where new words flow.
Romanian tales now softly sing,
Marketing magic in every spring!
Let's celebrate with a joyful cheer,
For every user, far and near! 🌸


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 added the 🚨 migrations 🚨 Be advised: PR contains database migrations - Auto-Generated by GitHub Actions on raising a PR label Jul 19, 2024
@dguyen
dguyen force-pushed the feat/i18n-marketing branch from 5443c86 to 3d49c4a Compare July 19, 2024 05:42

@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: 8

Outside diff range, codebase verification and nitpick comments (6)
packages/lib/server-only/i18n/switch-i18n-language.ts (2)

5-7: Consider using a more descriptive cookie name.

The cookie name 'i18n' might be too generic. Consider using a more descriptive name.

- cookies().set('i18n', lang);
+ cookies().set('i18n_language', lang);

5-7: Document the function.

Add a comment to describe the purpose and usage of the switchI18NLanguage function.

/**
 * Switches the i18n language by setting a cookie.
 * @param {string} lang - The language code to set.
 */
export const switchI18NLanguage = async (lang: string) => {
  cookies().set('i18n', lang);
};
packages/lib/client-only/providers/i18n.client.tsx (1)

24-24: Document the component.

Add a comment to describe the purpose and usage of the I18nClientProvider component.

/**
 * Provides i18n context to the application.
 * @param {Object} props - The component props.
 * @param {React.ReactNode} props.children - The child components.
 * @param {string} props.initialLocale - The initial locale.
 * @param {Messages} props.initialMessages - The initial messages.
 */
export function I18nClientProvider({
  children,
  initialLocale,
  initialMessages,
}: {
  children: React.ReactNode;
  initialLocale: string;
  initialMessages: Messages;
}) {
  return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
}
packages/lib/constants/i18n.ts (1)

1-1: Consider expanding supported language codes.

Currently, only 'de' and 'en' are supported. If there are plans to support more languages in the future, it might be beneficial to document this or provide a mechanism to easily add more languages.

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

17-17: Potential Issue with environment Key Usage

The environment key is not found in the GitHub Actions workflow files but is present in various Docker Compose files. This suggests that the addition of environment: Translations in the .github/workflows/translations-upload.yml file might be incorrect or misplaced. Please verify the correct usage of the environment key in GitHub Actions workflows.

  • .github/workflows/translations-upload.yml: Line 17
Analysis chain

LGTM! Ensure proper usage of the environment key.

Adding the environment key to the extract_translations job can help with environment-specific configurations or deployments.

Verify that the environment key is used correctly and consistently across the workflow.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the environment key in the workflow.

# Test: Search for the usage of the environment key. Expect: Only occurances of the correct usage.
rg --type yaml $'environment: Translations'

Length of output: 44


Script:

#!/bin/bash
# Description: Verify the usage of the environment key in the workflow.

# Test: Search for the usage of the environment key in the workflow YAML files.
rg --type yaml 'environment:'

Length of output: 403

packages/lib/translations/en/marketing.js (1)

1-1: Discrepancies found in translation keys.

The following discrepancies were found between the extracted keys and the expected keys in the translation file packages/lib/translations/en/marketing.js:

  • Missing keys or incorrectly included keys:
    • +1xAO7
    • +8Nek/
    • 1j9aoC
    • 2POOFK
    • 2YvdxE
    • 32yG8y
    • 4McJfQ
    • 4yiZOB
    • 5lWFkC
    • 652R6j
    • 6C9AxJ
    • 6YtxFj
    • 6zNyfI
    • 77/8W2
    • 7FPIvI
    • 7zGun7
    • 8AKApo
    • 8GpyFt
    • 8Zy3YU
    • 8e4lIo
    • 9VGuMA
    • 9mkNAn
    • AvYbUL
    • BOV7DD
    • CAL6E9
    • CHzOWB
    • CWe7wB
    • Csm+TN
    • CtgXe4
    • F9564X
    • FNv8t7
    • GDvlUT
    • GE1BlA
    • GHelWd
    • GNfoAO
    • HEDnID
    • I2ufwS
    • IAq/yr
    • IPgkVQ
    • J/hVSQ
    • JZbmjL
    • K6KbY4
    • KM6m8p
    • LOyqaC
    • MHrjPM
    • NApCXa
    • OIowgO
    • OWsQIe
    • OYoVNk
    • OpNhRn
    • R1aJ0W
    • RkUXMm
    • StoBff
    • TvY/XA
    • V+D/YP
    • V6EY8B
    • W/TUoX
    • W2nDs0
    • W6qD1T
    • WMfAK8
    • XYLcNv
    • Xi7f+z
    • XkF8tv
    • YcfUZ9
    • ZDIydz
    • ZSW8id
    • ZaMyxU
    • aLD+Td
    • aSWzT9
    • aoDa18
    • astDB+
    • b76QYo
    • bPpoCb
    • c3b0B0
    • cT9Z9e
    • cVPDPt
    • chL5IG
    • e+RpCP
    • eK0veR
    • eSfS30
    • f3Botn
    • f8fH8W
    • fByw/g
    • fxgcNV
    • gBefbz
    • igwAqT
    • jjAtjQ
    • k/ANik
    • kV0qBq
    • lm5v+6
    • mgQhDS
    • p5+XQN
    • pF9qTh
    • pS8wej
    • pfjrI2
    • phSPy7
    • qJVkX+
    • qOMroC
    • rKtmiD
    • rjGI/Q
    • rr83qK
    • rzQpex
    • sXswT6
    • sib3h3
    • tSS7hj
    • tkQ/WI
    • u0zktA
    • vERlcd
    • vXBVQZ
    • vaHmll
    • vb0Q0/
    • vdAd7c
    • wJijgU
    • y2DcZj
    • y2dGtU
    • z5kV0h
    • zkWmBh

Please review and correct these discrepancies to ensure the translation strings are complete and accurate.

Analysis chain

Ensure translation strings are complete and accurate.

The translation strings appear to be correctly formatted. However, ensure that all necessary strings are included and accurately translated.


Ensure translation strings are complete and accurate.

The initial check did not reveal any empty or null strings. To further verify, we need to ensure that all expected translation keys are present and correctly translated.


Ensure translation strings are complete and accurate.

The jq command failed due to a parse error, indicating potential issues with the JSON structure. Let's inspect the file contents to diagnose the problem.


Ensure translation strings are complete and accurate.

The JSON object in the file is wrapped in a JavaScript module export statement and passed to JSON.parse, which might be causing the parse error. Let's extract the JSON string and validate its structure separately.


Ensure translation strings are complete and accurate.

The JSON structure is valid. Now, let's compare the extracted keys with a reference list of expected keys to ensure completeness.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness and accuracy of translation strings.

# Test: Check for missing or untranslated strings. Expect: No missing or untranslated strings.
rg --type json -e '""' -e 'null' packages/lib/translations/en/marketing.js

Length of output: 74


Script:

#!/bin/bash
# Description: List all keys in the translation file.

# Extract all keys from the JSON object in the translation file.
jq 'keys' packages/lib/translations/en/marketing.js

Length of output: 109


Script:

#!/bin/bash
# Description: Print the contents of the translation file to inspect the JSON structure.

# Print the contents of the translation file.
cat packages/lib/translations/en/marketing.js

Length of output: 7952


Script:

#!/bin/bash
# Description: Extract JSON string from the translation file and validate its structure.

# Extract the JSON string from the JSON.parse call and save it to a temporary file.
sed -n 's/.*JSON.parse("\(.*\)").*/\1/p' packages/lib/translations/en/marketing.js | sed 's/\\"/"/g' > /tmp/marketing.json

# Validate the JSON structure using jq.
jq '.' /tmp/marketing.json

Length of output: 8019


Script:

#!/bin/bash
# Description: Compare the keys in the translation file with a reference list of expected keys.

# Extract the keys from the JSON object.
jq 'keys' /tmp/marketing.json > /tmp/extracted_keys.json

# Reference list of expected keys (this list should be provided or predefined).
cat <<EOF > /tmp/expected_keys.json
[
  "J/hVSQ",
  "u0zktA",
  "rKtmiD",
  "vaHmll",
  "gBefbz",
  "XkF8tv",
  "tkQ/WI",
  "qOMroC",
  "FNv8t7",
  "W/TUoX",
  "astDB+",
  "7zGun7",
  "fxgcNV",
  "V+D/YP",
  "CWe7wB",
  "JZbmjL",
  "chL5IG",
  "p5+XQN",
  "NApCXa",
  "z5kV0h",
  "YcfUZ9",
  "1NJjIG",
  "rr83qK",
  "75ojt0",
  "pF9qTh",
  "f8fH8W",
  "W6qD1T",
  "K6KbY4",
  "aLD+Td",
  "32yG8y",
  "+1xAO7",
  "TvY/XA",
  "tSS7hj",
  "BWMGM4",
  "V6EY8B",
  "C0/bri",
  "8Zy3YU",
  "ZSW8id",
  "sXswT6",
  "cT9Z9e",
  "k/ANik",
  "I7Exsw",
  "f3Botn",
  "y2DcZj",
  "2POOFK",
  "OdieZe",
  "IPgkVQ",
  "aSWzT9",
  "ZDIydz",
  "c3b0B0",
  "pS8wej",
  "7FPIvI",
  "kV0qBq",
  "652R6j",
  "R1aJ0W",
  "P1ovAc",
  "IAq/yr",
  "Xi7f+z",
  "9VGuMA",
  "fByw/g",
  "Csm+TN",
  "phSPy7",
  "pfjrI2",
  "LOyqaC",
  "PCgMVa",
  "TgL4dH",
  "wJijgU",
  "OIowgO",
  "GHelWd",
  "vXBVQZ",
  "+8Nek/",
  "6YtxFj",
  "CtgXe4",
  "OpNhRn",
  "6C9AxJ",
  "igwAqT",
  "jjAtjQ",
  "b76QYo",
  "OWsQIe",
  "Un80BR",
  "6zNyfI",
  "eK0veR",
  "I2ufwS",
  "F9564X",
  "qJVkX+",
  "aHCEmh",
  "rjGI/Q",
  "vERlcd",
  "77/8W2",
  "OYoVNk",
  "GDvlUT",
  "bUqwb8",
  "GNfoAO",
  "StoBff",
  "dhi4w4",
  "kZBxnz",
  "eSfS30",
  "aoDa18",
  "5lWFkC",
  "e+RpCP",
  "4yiZOB",
  "RkUXMm",
  "omz3DH",
  "AvYbUL",
  "y2dGtU",
  "uAQUqI",
  "XYLcNv",
  "KM6m8p",
  "lm5v+6",
  "CAL6E9",
  "w4nM1s",
  "yFoQ27",
  "GE1BlA",
  "MHrjPM",
  "2YvdxE",
  "8e4lIo",
  "bPpoCb",
  "vb0Q0/",
  "mgQhDS",
  "4McJfQ",
  "9mkNAn",
  "CHzOWB",
  "BOV7DD",
  "vdAd7c",
  "W2nDs0",
  "WMfAK8",
  "ZaMyxU",
  "8GpyFt",
  "HEDnID",
  "sib3h3",
  "cVPDPt",
  "zkWmBh",
  "8AKApo",
  "rzQpex",
  "1j9aoC"
]
EOF

# Compare the extracted keys with the expected keys.
diff /tmp/extracted_keys.json /tmp/expected_keys.json

Length of output: 3637

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 994f686 and 9e82706.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (57)
  • .eslintrc.cjs (1 hunks)
  • .github/workflows/translations-extract.yml (1 hunks)
  • .github/workflows/translations-pull.yml (3 hunks)
  • .github/workflows/translations-upload.yml (2 hunks)
  • .husky/pre-commit (1 hunks)
  • .prettierignore (1 hunks)
  • apps/marketing/lingui.config.ts (1 hunks)
  • apps/marketing/next.config.js (2 hunks)
  • apps/marketing/package.json (4 hunks)
  • apps/marketing/src/app/(marketing)/blog/page.tsx (3 hunks)
  • apps/marketing/src/app/(marketing)/open/data.ts (1 hunks)
  • apps/marketing/src/app/(marketing)/open/funding-raised.tsx (4 hunks)
  • apps/marketing/src/app/(marketing)/open/monthly-completed-documents-chart.tsx (4 hunks)
  • apps/marketing/src/app/(marketing)/open/monthly-new-users-chart.tsx (5 hunks)
  • apps/marketing/src/app/(marketing)/open/monthly-total-users-chart.tsx (5 hunks)
  • apps/marketing/src/app/(marketing)/open/page.tsx (7 hunks)
  • apps/marketing/src/app/(marketing)/open/salary-bands.tsx (2 hunks)
  • apps/marketing/src/app/(marketing)/open/team-members.tsx (3 hunks)
  • apps/marketing/src/app/(marketing)/open/tooltip.tsx (2 hunks)
  • apps/marketing/src/app/(marketing)/open/total-signed-documents-chart.tsx (4 hunks)
  • apps/marketing/src/app/(marketing)/open/typefully.tsx (2 hunks)
  • apps/marketing/src/app/(marketing)/page.tsx (2 hunks)
  • apps/marketing/src/app/(marketing)/pricing/page.tsx (4 hunks)
  • apps/marketing/src/app/layout.tsx (4 hunks)
  • apps/marketing/src/components/(marketing)/call-to-action.tsx (2 hunks)
  • apps/marketing/src/components/(marketing)/callout.tsx (3 hunks)
  • apps/marketing/src/components/(marketing)/carousel.tsx (9 hunks)
  • apps/marketing/src/components/(marketing)/enterprise.tsx (3 hunks)
  • apps/marketing/src/components/(marketing)/faster-smarter-beautiful-bento.tsx (4 hunks)
  • apps/marketing/src/components/(marketing)/footer.tsx (5 hunks)
  • apps/marketing/src/components/(marketing)/header.tsx (4 hunks)
  • apps/marketing/src/components/(marketing)/hero.tsx (3 hunks)
  • apps/marketing/src/components/(marketing)/i18n-switcher.tsx (1 hunks)
  • apps/marketing/src/components/(marketing)/mobile-navigation.tsx (3 hunks)
  • apps/marketing/src/components/(marketing)/open-build-template-bento.tsx (4 hunks)
  • apps/marketing/src/components/(marketing)/pricing-table.tsx (9 hunks)
  • apps/marketing/src/components/(marketing)/share-connect-paid-widget-bento.tsx (5 hunks)
  • apps/marketing/src/middleware.ts (1 hunks)
  • apps/web/lingui.config.ts (1 hunks)
  • apps/web/next.config.js (2 hunks)
  • apps/web/package.json (4 hunks)
  • crowdin.yml (1 hunks)
  • lingui.config.ts (1 hunks)
  • package.json (4 hunks)
  • packages/lib/client-only/providers/i18n.client.tsx (1 hunks)
  • packages/lib/client-only/providers/i18n.server.tsx (1 hunks)
  • packages/lib/constants/i18n.ts (1 hunks)
  • packages/lib/server-only/i18n/switch-i18n-language.ts (1 hunks)
  • packages/lib/translations/de/common.po (1 hunks)
  • packages/lib/translations/de/marketing.js (1 hunks)
  • packages/lib/translations/de/marketing.po (1 hunks)
  • packages/lib/translations/de/web.js (1 hunks)
  • packages/lib/translations/de/web.po (1 hunks)
  • packages/lib/translations/en/common.po (1 hunks)
  • packages/lib/translations/en/marketing.js (1 hunks)
  • packages/lib/translations/en/marketing.po (1 hunks)
  • packages/lib/translations/en/web.js (1 hunks)
Files not processed due to max files limit (7)
  • packages/lib/translations/en/web.po
  • packages/lib/tsconfig.json
  • packages/lib/utils/i18n.ts
  • packages/tsconfig/nextjs.json
  • packages/ui/components/document/document-global-auth-action-select.tsx
  • packages/ui/package.json
  • turbo.json
Files skipped from review due to trivial changes (9)
  • .eslintrc.cjs
  • .prettierignore
  • crowdin.yml
  • packages/lib/translations/de/common.po
  • packages/lib/translations/de/web.js
  • packages/lib/translations/de/web.po
  • packages/lib/translations/en/common.po
  • packages/lib/translations/en/marketing.po
  • packages/lib/translations/en/web.js
Additional context used
Biome
packages/lib/client-only/providers/i18n.server.tsx

[error] 31-31: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)


[error] 45-45: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Additional comments not posted (170)
.husky/pre-commit (1)

16-19: Ensure commands are idempotent.

Make sure that the translate:extract and translate:compile commands are idempotent to avoid issues during repeated executions.

packages/lib/constants/i18n.ts (4)

3-3: Type definition is correct and concise.

The type definition for SupportedLanguageCodes is accurate and leverages TypeScript's as const assertion effectively.


5-8: Config object is well-defined.

The APP_I18N_OPTIONS object is well-structured and uses as const to ensure immutability.


10-13: Type definition for SupportedLanguage is clear and appropriate.

The SupportedLanguage type is straightforward and accurately represents the structure of supported languages.


15-24: Ensure all supported languages are included.

The SUPPORTED_LANGUAGES object correctly maps language codes to their respective full and short names. Ensure that all supported languages are included here.

apps/web/lingui.config.ts (7)

1-1: Import statement is correct.

The import statement correctly imports the LinguiConfig type from @lingui/conf.


3-3: Import statement is correct.

The import statement correctly imports APP_I18N_OPTIONS from the specified path.


5-5: Comment explains the purpose of the file.

The comment effectively explains that this configuration extends the root lingui.config.cjs.


6-8: Ensure type assertion consistency.

The type assertion for locales is necessary due to TypeScript constraints. Ensure this pattern is consistent across similar configurations.


9-18: Catalog paths are well-defined.

The paths for translation catalogs are clearly defined and include the necessary directories for the web application and common resources.


19-19: Catalog merge path is well-defined.

The catalogsMergePath is correctly set to merge translations for the web application.


22-22: Export statement is correct.

The export statement correctly exports the config object as the default export.

apps/marketing/lingui.config.ts (7)

1-1: Import statement is correct.

The import statement correctly imports the LinguiConfig type from @lingui/conf.


3-3: Import statement is correct.

The import statement correctly imports APP_I18N_OPTIONS from the specified path.


5-5: Comment explains the purpose of the file.

The comment effectively explains that this configuration extends the root lingui.config.cjs.


6-8: Ensure type assertion consistency.

The type assertion for locales is necessary due to TypeScript constraints. Ensure this pattern is consistent across similar configurations.


9-18: Catalog paths are well-defined.

The paths for translation catalogs are clearly defined and include the necessary directories for the marketing application and common resources.


19-19: Catalog merge path is well-defined.

The catalogsMergePath is correctly set to merge translations for the marketing application.


22-22: Export statement is correct.

The export statement correctly exports the config object as the default export.

lingui.config.ts (4)

1-4: LGTM! Imports are appropriate.

The import statements correctly bring in necessary types and constants.


5-7: LGTM! Configuration for sourceLocale and locales is correct.

The sourceLocale and locales settings align with the provided APP_I18N_OPTIONS.


28-28: LGTM! Export statement is correct.

The configuration object is correctly exported as default.


8-24: Verify catalog paths and ensure consistency with crowdin.yml.

The catalog paths are well-organized, separating translations for marketing, web, and common resources. Ensure these paths are reflected in the crowdin.yml file.

apps/marketing/src/middleware.ts (3)

1-6: LGTM! Imports are appropriate.

The import statements correctly bring in necessary modules and utilities.


7-17: LGTM! Middleware logic is correct.

The middleware function correctly extracts the supported language and sets the i18n cookie.


20-39: LGTM! Matcher configuration is correct.

The matcher configuration correctly excludes specific paths and handles requests appropriately.

.github/workflows/translations-extract.yml (5)

1-9: LGTM! Workflow metadata is correct.

The workflow metadata, including the name and triggers, aligns with the PR objectives.


10-13: LGTM! Concurrency settings are correct.

The concurrency settings prevent duplicate runs and align with best practices.


14-25: LGTM! Checkout and dependency installation steps are correct.

The steps for checking out code and installing dependencies are appropriate and align with the PR objectives.


28-31: LGTM! Translation extraction and compilation steps are correct.

The steps for extracting and compiling translations are appropriate and align with the PR objectives.


33-38: LGTM! Commit and push steps are correct.

The steps for committing and pushing changes are appropriate and align with the PR objectives.

apps/marketing/src/components/(marketing)/enterprise.tsx (3)

5-5: Import statement for Trans component is correct.

The import statement correctly brings in the Trans component from the @lingui/macro package.


16-16: Usage of Trans component in header text is correct.

The header text "Enterprise Compliance, License or Technical Needs?" is correctly wrapped in the Trans component for translation.


35-35: Usage of Trans component in button text is correct.

The button text "Contact Us" is correctly wrapped in the Trans component for translation.

apps/marketing/src/components/(marketing)/call-to-action.tsx (4)

3-3: Import statement for Trans component is correct.

The import statement correctly brings in the Trans component from the @lingui/macro package.


19-19: Usage of Trans component in header text is correct.

The header text "Join the Open Signing Movement" is correctly wrapped in the Trans component for translation.


23-26: Usage of Trans component in paragraph text is correct.

The paragraph text is correctly wrapped in the Trans component for translation.


31-31: Usage of Trans component in button text is correct.

The button text "Get started" is correctly wrapped in the Trans component for translation.

apps/marketing/src/app/(marketing)/open/typefully.tsx (5)

7-7: Import statement for Trans component is correct.

The import statement correctly brings in the Trans component from the @lingui/macro package.


20-20: Usage of Trans component in header text is correct.

The header text "Twitter Stats" is correctly wrapped in the Trans component for translation.


28-29: Usage of Trans component in link text is correct.

The link text "Documenso on X" is correctly wrapped in the Trans component for translation.


33-33: Usage of Trans component in button text is correct.

The button text "View all stats" is correctly wrapped in the Trans component for translation.


38-38: Usage of Trans component in button text is correct.

The button text "Follow us on X" is correctly wrapped in the Trans component for translation.

apps/marketing/src/components/(marketing)/callout.tsx (2)

5-5: Import statement approved.

The import of the Trans component from @lingui/macro is correct and necessary for internationalization.


27-29: Internationalization support added.

The use of the Trans component from @lingui/macro for the text "Try our Free Plan" and "No Credit Card required" is correct and enhances the component by adding internationalization support.

apps/marketing/src/app/(marketing)/page.tsx (2)

5-5: Import statement approved.

The import of the setupI18nSSR function from @documenso/lib/client-only/providers/i18n.server is correct and necessary for internationalization.


29-30: Internationalization support added.

The addition of the setupI18nSSR function call for server-side rendering support for internationalization is correct and enhances the component.

.github/workflows/translations-pull.yml (3)

6-7: Schedule trigger approved.

The addition of the schedule trigger to run the workflow every two hours is correct and ensures that translations are pulled regularly.


19-19: Job environment approved.

The addition of the environment for the pull_translations job is correct and helps in context-specific configurations or permissions.


49-49: Environment variable update approved.

The update to the environment variable GITHUB_TOKEN from secrets.GITHUB_CROWDIN_TOKEN to secrets.GH_PAT is correct and likely enhances security or complies with updated practices.

apps/marketing/src/app/(marketing)/open/tooltip.tsx (2)

3-3: Import statement for Trans component is correct.

The import statement for the Trans component from @lingui/macro is necessary for internationalization.


34-36: Usage of Trans component is correct.

The text "Customers with an Active Subscriptions." is correctly wrapped in a <Trans> component for internationalization.

apps/marketing/package.json (2)

14-14: New script for translation compilation is correct.

The new script "translate:compile": "lingui compile --typescript" is correctly added to facilitate the compilation of translation files.


23-26: New dependencies for localization and translation are correct.

The new dependencies @lingui/macro, @lingui/react, cmdk, @lingui/loader, and @lingui/swc-plugin are correctly added and necessary for the changes.

Also applies to: 53-54

apps/marketing/src/app/(marketing)/open/monthly-new-users-chart.tsx (4)

3-4: Import statements for Trans, msg, and useLingui are correct.

The import statements for Trans, msg, and useLingui from @lingui/macro and @lingui/react are necessary for internationalization.


16-17: Usage of useLingui hook is correct.

The useLingui hook is correctly used to access the translation function _.


29-31: Usage of Trans component for the heading is correct.

The static heading "New Users" is correctly replaced with a translatable component using <Trans>New Users</Trans>.


43-43: Usage of translation function _ for the tooltip and bar chart label is correct.

The translation function _ is correctly used for the label "New Users" in the tooltip and bar chart.

Also applies to: 52-52

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

6-7: LGTM! Ensure correctness of event trigger configuration.

Enabling the push event trigger for the main branch is a common practice for CI/CD workflows.

Verify that the push event trigger is correctly configured to avoid unintended triggers.

Verification successful

The push event trigger configuration is correctly set up.

The push event trigger is configured to trigger on pushes to the main branch, as expected. Here is the relevant snippet from the .github/workflows/translations-upload.yml file:

  • on:
    • workflow_dispatch:
    • workflow_call:
    • push:
      • branches: ['main']
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the push event trigger configuration.

# Test: Search for the push event trigger configuration. Expect: Only occurances of the correct configuration.
rg --type yaml -A 2 $'push:\n  branches: [\'main\']'

Length of output: 248


Script:

#!/bin/bash
# Description: Verify the correctness of the push event trigger configuration.

# Test: Search for the push event trigger configuration. Expect: Only occurrences of the correct configuration.
rg --type yaml --multiline -A 2 $'push:\n  branches: [\'main\']'

Length of output: 68


Script:

#!/bin/bash
# Description: Search for the push event trigger configuration in YAML files.

# Test: Search for the push event in YAML files and include enough context lines to verify the configuration manually.
rg --type yaml -A 5 'push:'

Length of output: 27


Script:

#!/bin/bash
# Description: Search for any push event trigger configurations in all YAML files.

# Test: Search for any push event configurations in YAML files.
rg --type yaml 'push:'

Length of output: 22


Script:

#!/bin/bash
# Description: Search for all event triggers in the translations-upload.yml file.

# Test: Search for all event triggers in the specified YAML file and include enough context lines to verify the configuration manually.
rg --type yaml -A 5 'on:' .github/workflows/translations-upload.yml

Length of output: 274

apps/marketing/src/app/(marketing)/open/salary-bands.tsx (3)

3-4: LGTM!

The import statement for the Trans component from the Lingui library is correct and necessary for the integration.


22-24: LGTM!

Wrapping the header text "Global Salary Bands" in the Trans component facilitates localization and is a best practice for internationalization.


30-38: LGTM!

Wrapping the table headers "Title," "Seniority," and "Salary" in the Trans component facilitates localization and is a best practice for internationalization.

apps/marketing/src/app/(marketing)/open/monthly-total-users-chart.tsx (4)

3-4: LGTM!

The import statements for the Trans and msg components from the Lingui library and the useLingui hook are correct and necessary for the integration.


16-17: LGTM!

Using the useLingui hook to create a constant for translation is a best practice for internationalization.


29-31: LGTM!

Wrapping the header text "Total Users" in the Trans component facilitates localization and is a best practice for internationalization.


Line range hint 43-52:
LGTM!

Using the translation function in the formatter for the tooltip and the label for the bars in the chart ensures that the text is translatable, which is a best practice for internationalization.

apps/marketing/src/app/(marketing)/open/monthly-completed-documents-chart.tsx (4)

3-4: Imports for Lingui library look good.

The import statements for Trans and useLingui are correctly added from @lingui/macro and @lingui/react.


19-20: Usage of useLingui hook looks good.

The useLingui hook is correctly used to access the translation function _.


33-34: Usage of Trans component looks good.

The static string "Completed Documents per Month" is correctly replaced with the Trans component for translation.


55-55: Usage of translation function _ looks good.

The label for the bar chart is correctly translated using the _ function.

apps/marketing/src/app/(marketing)/open/total-signed-documents-chart.tsx (4)

3-4: Imports for Lingui library look good.

The import statements for Trans and useLingui are correctly added from @lingui/macro and @lingui/react.


16-17: Usage of useLingui hook looks good.

The useLingui hook is correctly used to access the translation function _.


30-31: Usage of Trans component looks good.

The static string "Total Completed Documents" is correctly replaced with the Trans component for translation.


55-55: Usage of translation function _ looks good.

The label for the bar chart is correctly translated using the _ function.

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

1-12: Imports for Lingui library and other dependencies look good.

The import statements for server-only, cookies from next/headers, and various Lingui-related imports are correctly added.


15-25: Function loadCatalog implementation looks good.

The function correctly loads translation catalogs based on the locale and application type.


53-66: Function setupI18nSSR implementation looks good.

The function correctly sets up i18n for server-side rendering (SSR).

apps/web/package.json (2)

15-15: LGTM! The new script is correctly added.

The translate:compile script is a necessary addition for compiling translation files.


26-27: LGTM! The new dependencies are correctly added.

The dependencies @lingui/macro, @lingui/react, @lingui/loader, and @lingui/swc-plugin are necessary for the Lingui integration.

Also applies to: 63-64

apps/marketing/src/app/(marketing)/open/team-members.tsx (3)

3-4: LGTM! The new imports are correctly added.

The imports for Trans and useLingui are necessary for the localization implementation.


21-22: LGTM! The localization is correctly implemented.

The use of useLingui and Trans components for localization is appropriate and aligns with the project's needs.


25-27: LGTM! The JSX elements are correctly wrapped with Trans components.

The wrapping of JSX elements with Trans components for localization is appropriate and aligns with the project's needs.

Also applies to: 33-50, 66-66

apps/marketing/src/components/(marketing)/i18n-switcher.tsx (3)

1-13: LGTM! The new imports are correctly added.

The imports for useState, msg, useLingui, CheckIcon, LuLanguages, SUPPORTED_LANGUAGES, switchI18NLanguage, dynamicActivate, cn, Button, and CommandDialog are necessary for the language switcher component.


25-37: LGTM! The function is correctly implemented.

The I18nSwitcher function is appropriately implemented to switch languages using Lingui.


39-44: LGTM! The JSX elements are correctly implemented.

The JSX elements for the language switcher are appropriately implemented and align with the project's needs.

Also applies to: 46-69

apps/marketing/src/app/(marketing)/open/data.ts (2)

1-1: Import msg function for i18n.

The msg function from @lingui/macro is correctly imported for internationalization.


9-9: Integrate msg function for engagement property.

The engagement property is correctly wrapped with the msg function for internationalization.

Also applies to: 17-17, 25-25, 33-33, 41-41, 49-49

apps/marketing/src/app/(marketing)/open/funding-raised.tsx (4)

5-6: Import Trans component and useLingui hook for i18n.

The Trans component and useLingui hook from @lingui/macro and @lingui/react are correctly imported for internationalization.


16-17: Use useLingui hook for i18n.

The useLingui hook is correctly used to get the _ function for internationalization.


28-30: Wrap text with Trans component for i18n.

The text "Total Funding Raised" is correctly wrapped with the Trans component for internationalization.


58-58: Use _ function for i18n.

The text "Amount Raised" is correctly passed through the _ function for internationalization.

Also applies to: 65-65

apps/marketing/src/components/(marketing)/header.tsx (2)

9-9: Import Trans component for i18n.

The Trans component from @lingui/macro is correctly imported for internationalization.


42-42: Wrap text with Trans component for i18n.

The text "Pricing", "Blog", "Open Startup", "Sign in", and "Sign up" are correctly wrapped with the Trans component for internationalization.

Also applies to: 57-57, 64-64, 72-72, 77-77

apps/web/next.config.js (2)

34-34: LGTM! The addition of swcPlugins aligns with the Lingui library usage.

The swcPlugins property in the experimental configuration correctly specifies the use of the @lingui/swc-plugin.


63-68: LGTM! The new Webpack rule for processing .po files is correctly configured.

The rule addition to the module.rules array ensures that .po files are processed using the @lingui/loader, aligning with the Lingui library's requirements.

apps/marketing/next.config.js (2)

33-33: LGTM! The addition of swcPlugins aligns with the Lingui library usage.

The swcPlugins property in the experimental configuration correctly specifies the use of the @lingui/swc-plugin.


59-64: LGTM! The new Webpack rule for processing .po files is correctly configured.

The rule addition to the module.rules array ensures that .po files are processed using the @lingui/loader, aligning with the Lingui library's requirements.

apps/marketing/src/app/(marketing)/blog/page.tsx (3)

3-3: LGTM! The import of the Trans component is correct.

The Trans component from @lingui/macro is correctly imported for internationalization support.


6-6: LGTM! The setupI18nSSR function call is correctly implemented.

The setupI18nSSR function initializes i18n support, and the extracted i18n object is used within the component.

Also applies to: 13-13


25-27: LGTM! The Trans component is correctly used for text translation.

The Trans component wraps text elements, enabling translation and improving the multilingual capabilities of the blog page.

Also applies to: 30-33, 45-45

package.json (4)

35-35: Script translate:extract added successfully.

The script translate:extract uses lingui extract to extract translations, aligning with the PR objectives.


36-36: Script translate:compile added successfully.

The script translate:compile uses turbo run with appropriate filters to compile translations, aligning with the PR objectives.


46-46: DevDependency @lingui/cli added successfully.

The devDependency @lingui/cli is added with version 4.11.1, supporting the translation extraction script.


66-66: Dependency @lingui/core added successfully.

The dependency @lingui/core is added with version 4.11.1, supporting the translation functionalities.

apps/marketing/src/components/(marketing)/open-build-template-bento.tsx (5)

5-5: Imported Trans component successfully.

The Trans component from @lingui/macro is imported to support internationalization, aligning with the PR objectives.


27-30: Heading text wrapped in Trans component.

The heading text is correctly wrapped in the Trans component, supporting internationalization.


37-43: First card content wrapped in Trans component.

The first card content is correctly wrapped in the Trans component, supporting internationalization.


59-62: Second card content wrapped in Trans component.

The second card content is correctly wrapped in the Trans component, supporting internationalization.


78-84: Third card content wrapped in Trans component.

The third card content is correctly wrapped in the Trans component, supporting internationalization.

apps/marketing/src/components/(marketing)/footer.tsx (5)

8-9: Imported msg and useLingui successfully.

The msg function from @lingui/macro and useLingui hook from @lingui/react are imported to support internationalization, aligning with the PR objectives.


18-18: Imported I18nSwitcher component successfully.

The I18nSwitcher component is imported to support language switching, aligning with the PR objectives.


31-43: Footer links wrapped in msg function.

The footer link text is correctly wrapped in the msg function, supporting internationalization.


47-47: useLingui hook used successfully.

The useLingui hook is used to dynamically retrieve translated strings, supporting internationalization.


100-101: I18nSwitcher component added to the footer.

The I18nSwitcher component is added to the footer, enhancing user accessibility to language options.

apps/marketing/src/components/(marketing)/mobile-navigation.tsx (4)

6-7: Imports for i18n look good.

The imports for msg and useLingui are necessary for the internationalization changes.


24-61: Internationalization of navigation links looks good.

The text values in MENU_NAVIGATION_LINKS are correctly updated to use msg for localization.


66-67: Usage of useLingui hook looks good.

The useLingui hook is correctly used to access the translation function _.


119-119: Text rendering logic for translations looks good.

The text rendering logic is updated to use the translation function _ for non-string text values, ensuring proper localization.

apps/marketing/src/components/(marketing)/faster-smarter-beautiful-bento.tsx (5)

5-6: Import for Trans looks good.

The import for Trans from @lingui/macro is necessary for the internationalization changes.


30-33: Internationalization of headings looks good.

The static text strings are correctly replaced with the <Trans> component for localization.


40-46: Internationalization of "Fast" section looks good.

The text content in the "Fast" section is correctly wrapped in the <Trans> component for localization.


62-68: Internationalization of "Beautiful" section looks good.

The text content in the "Beautiful" section is correctly wrapped in the <Trans> component for localization.


84-89: Internationalization of "Smart" section looks good.

The text content in the "Smart" section is correctly wrapped in the <Trans> component for localization.

apps/marketing/src/app/layout.tsx (5)

9-10: Imports for i18n look good.

The imports for I18nClientProvider and setupI18nSSR are necessary for the internationalization changes.


59-60: Usage of setupI18nSSR function looks good.

The setupI18nSSR function is correctly used to retrieve the current language and i18n messages.


63-63: Dynamic lang attribute looks good.

The lang attribute of the <html> tag is correctly set dynamically based on the retrieved language.


72-72: Meta tag for Google not to translate looks good.

The meta tag instructing Google not to translate the page content is correctly added.


86-90: Usage of I18nClientProvider looks good.

The I18nClientProvider correctly wraps the children components, providing them access to the i18n context.

apps/marketing/src/components/(marketing)/hero.tsx (4)

6-6: LGTM!

The import statement for the Trans component from the @lingui/macro library is appropriate for the internationalization implementation.


100-104: Correct usage of the Trans component for internationalization.

The text elements within the Hero component are correctly wrapped in the Trans component for internationalization.


119-121: Correct usage of the Trans component for internationalization.

The text elements within the Button component are correctly wrapped in the Trans component for internationalization.


128-128: Correct usage of the Trans component for internationalization.

The text element within the Button component for the GitHub link is correctly wrapped in the Trans component for internationalization.

apps/marketing/src/components/(marketing)/share-connect-paid-widget-bento.tsx (6)

5-5: LGTM!

The import statement for the Trans component from the @lingui/macro library is appropriate for the internationalization implementation.


31-34: Correct usage of the Trans component for internationalization.

The text elements within the h2 tag are correctly wrapped in the Trans component for internationalization.


41-44: Correct usage of the Trans component for internationalization.

The text elements within the CardContent component are correctly wrapped in the Trans component for internationalization.


60-66: Correct usage of the Trans component for internationalization.

The text elements within the CardContent component are correctly wrapped in the Trans component for internationalization.


82-87: Correct usage of the Trans component for internationalization.

The text elements within the CardContent component are correctly wrapped in the Trans component for internationalization.


103-109: Correct usage of the Trans component for internationalization.

The text elements within the CardContent component are correctly wrapped in the Trans component for internationalization.

apps/marketing/src/components/(marketing)/pricing-table.tsx (11)

8-8: Import statement for Trans component is correct.

The import statement for the Trans component from @lingui/macro is necessary and correctly added.


40-40: Correct usage of <Trans> component for "Monthly".

The text "Monthly" is correctly wrapped in the <Trans> component for localization.


60-60: Correct usage of <Trans> component for "Yearly".

The text "Yearly" is correctly wrapped in the <Trans> component for localization.


62-62: Correct usage of <Trans> component for "Save $60 or $120".

The text "Save $60 or $120" is correctly wrapped in the <Trans> component for localization.


80-80: Correct usage of <Trans> component for "Free".

The text "Free" is correctly wrapped in the <Trans> component for localization.


85-85: Correct usage of <Trans> component for "For small teams and individuals with basic needs.".

The text "For small teams and individuals with basic needs." is correctly wrapped in the <Trans> component for localization.


94-94: Correct usage of <Trans> component for "Signup Now".

The text "Signup Now" is correctly wrapped in the <Trans> component for localization.


100-107: Correct usage of <Trans> component for feature descriptions.

The feature descriptions are correctly wrapped in the <Trans> component for localization.


118-118: Correct usage of <Trans> component for "Individual".

The text "Individual" is correctly wrapped in the <Trans> component for localization.


128-128: Correct usage of <Trans> component for "Everything you need for a great signing experience.".

The text "Everything you need for a great signing experience." is correctly wrapped in the <Trans> component for localization.


Line range hint 142-201: Correct usage of <Trans> component for feature descriptions in the "Teams" plan.

The feature descriptions in the "Teams" plan are correctly wrapped in the <Trans> component for localization.

packages/lib/translations/de/marketing.js (2)

1-1: Correct structure for the translation file.

The file uses module.exports to export translations as JSON, which is the correct structure for translation files.


1-1: Correct content for the translation file.

The file contains German translations for various strings used in the marketing section, and the translations appear to be correct.

apps/marketing/src/components/(marketing)/carousel.tsx (11)

5-6: Import statements for Trans, msg, and useLingui are correct.

The import statements for Trans, msg, and useLingui from @lingui/macro and @lingui/react are necessary and correctly added.


19-19: Correct usage of msg function for "Signing Process".

The text "Signing Process" is correctly wrapped in the msg function for localization.


25-25: Correct usage of msg function for "Teams".

The text "Teams" is correctly wrapped in the msg function for localization.


37-37: Correct usage of msg function for "Direct Link".

The text "Direct Link" is correctly wrapped in the msg function for localization.


55-55: Correct usage of msg function for "Profile".

The text "Profile" is correctly wrapped in the msg function for localization.


63-63: Correct usage of useLingui hook.

The useLingui hook is correctly used to access the translation function for dynamic translation.


93-96: Improved control flow in onThumbClick function.

The control flow adjustments improve readability and maintainability.


103-106: Improved control flow in onSelect function.

The control flow adjustments improve readability and maintainability.


112-114: Correct type assertion for autoplay plugin.

The type assertion for the autoplay plugin ensures correct type resolution and addresses potential issues.


258-258: Correct usage of <Trans> component for video tag error message.

The error message for unsupported video tag is correctly wrapped in the <Trans> component for localization.


282-282: Correct usage of typeof check for slide labels.

The typeof check ensures proper handling of slide labels, whether they are strings or translatable messages.

apps/marketing/src/app/(marketing)/pricing/page.tsx (3)

4-6: LGTM! Imports are correct and necessary.

The new imports for Trans and setupI18nSSR are appropriate for the i18n implementation.


39-41: LGTM! Text wrapping with <Trans> is correct.

The static text is correctly wrapped in <Trans> components for translation.

Also applies to: 44-45, 46-47, 61-69, 75-75, 89-99, 105-113, 119-128, 134-157, 163-171


34-35: Ensure setupI18nSSR is correctly initialized.

The setupI18nSSR function is called to initialize server-side internationalization. Verify that this function is correctly implemented and necessary for the PricingPage.

Verification successful

Let's gather more information by performing a broader search for the setupI18nSSR function implementation.


To ensure the setupI18nSSR function is correctly implemented, let's extract its full implementation.


The setupI18nSSR function is correctly implemented and necessary for the PricingPage to handle server-side internationalization.

  • The function is defined in packages/lib/client-only/providers/i18n.server.tsx.
  • It extracts the supported language from cookies, sets the i18n instance, and returns both.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `setupI18nSSR`.

# Test: Search for the function implementation. Expect: Correct implementation.
ast-grep --lang typescript --pattern $'function setupI18nSSR($_) { $$$ }'

Length of output: 74


Script:

#!/bin/bash
# Description: Search for the `setupI18nSSR` function definition across the codebase.

# Use ripgrep to search for the function definition.
rg 'function setupI18nSSR' -A 10

# Additionally, search for any export statements related to `setupI18nSSR`.
rg 'export .*setupI18nSSR' -A 2

Length of output: 323


Script:

#!/bin/bash
# Extract the full implementation of the `setupI18nSSR` function.
rg 'export const setupI18nSSR' -A 20 packages/lib/client-only/providers/i18n.server.tsx

Length of output: 362

apps/marketing/src/app/(marketing)/open/page.tsx (4)

3-4: LGTM! Imports are correct and necessary.

The new imports for Trans, msg, useLingui, and setupI18nSSR are appropriate for the i18n implementation.

Also applies to: 7-7


160-162: LGTM! Text wrapping with <Trans> and msg is correct.

The static text is correctly wrapped in <Trans> components and dynamic text uses the msg function for translation.

Also applies to: 165-176, 194-199, 209-211, 218-220, 225-234, 251-252, 261-262, 267-268, 288-290, 293-296


134-135: Ensure setupI18nSSR is correctly initialized.

The setupI18nSSR function is called to initialize server-side internationalization. Verify that this function is correctly implemented and necessary for the OpenPage.

Verification successful

Ensure setupI18nSSR is correctly initialized.

The setupI18nSSR function is correctly implemented to initialize server-side internationalization. It extracts the supported language from cookies, sets the i18n instance for the given language, and returns the language and i18n instance.

  • setupI18nSSR is defined in packages/lib/client-only/providers/i18n.server.tsx.
  • It is correctly imported and used in apps/marketing/src/app/(marketing)/open/page.tsx.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `setupI18nSSR`.

# Test: Search for the function implementation. Expect: Correct implementation.
ast-grep --lang typescript --pattern $'function setupI18nSSR($_) { $$$ }'

Length of output: 74


Script:

#!/bin/bash
# Description: Search for any definition of `setupI18nSSR` in the codebase.

# Test: Search for the function definition. Expect: Any definition of `setupI18nSSR`.
rg 'setupI18nSSR'

Length of output: 1095


Script:

#!/bin/bash
# Description: Display the implementation of `setupI18nSSR` in `packages/lib/client-only/providers/i18n.server.tsx`.

# Test: Display the function implementation. Expect: Correct implementation of `setupI18nSSR`.
rg -A 20 'export const setupI18nSSR' packages/lib/client-only/providers/i18n.server.tsx

Length of output: 362


136-136: Ensure useLingui hook is correctly used.

The useLingui hook is used to access the i18n context. Verify that this hook is correctly implemented and necessary for the OpenPage.

packages/lib/translations/de/marketing.po (1)

1-24: Verify translations for accuracy and consistency.

Ensure that the translations are accurate and consistent with the original text.

Verification successful

Verify translations for accuracy and consistency.

Ensure that the translations are accurate and consistent with the original text.


Verified translations for accuracy and consistency.

The translations in the file packages/lib/translations/de/marketing.po are accurate and consistent with the original text.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the accuracy and consistency of translations.

# Test: Compare the original strings with the translated strings. Expect: Accurate and consistent translations.
ast-grep --lang json --pattern $'{
  "msgid": "$_",
  "msgstr": "$_"
}'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify the accuracy and consistency of translations in .po files.

# Test: Compare the original strings (msgid) with the translated strings (msgstr) in the .po file.
# Expect: Accurate and consistent translations.

# Extract all msgid and msgstr pairs from the .po file.
grep -E 'msgid|msgstr' packages/lib/translations/de/marketing.po

Length of output: 15233

Comment on lines +1 to +2
'use server';

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.

Remove unnecessary 'use server' directive.

The 'use server' directive is not required in this context.

- 'use server';
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'use server';

Comment on lines +5 to +7
// eslint-disable-next-line @typescript-eslint/require-await
export const switchI18NLanguage = async (lang: string) => {
cookies().set('i18n', lang);

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.

Ensure proper error handling for cookie operations.

The function does not handle potential errors that might occur while setting the cookie.

export const switchI18NLanguage = async (lang: string) => {
  try {
    cookies().set('i18n', lang);
  } catch (error) {
    console.error('Failed to set i18n cookie:', error);
  }
};
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// eslint-disable-next-line @typescript-eslint/require-await
export const switchI18NLanguage = async (lang: string) => {
cookies().set('i18n', lang);
// eslint-disable-next-line @typescript-eslint/require-await
export const switchI18NLanguage = async (lang: string) => {
try {
cookies().set('i18n', lang);
} catch (error) {
console.error('Failed to set i18n cookie:', error);
}
};

Comment thread .husky/pre-commit
Comment on lines +16 to +19
echo "Extract and compile translations"
npm run translate:extract
npm run translate:compile
git add "$MONOREPO_ROOT/packages/lib/translations/"

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.

Add error handling for translation commands.

Ensure that errors during translation extraction and compilation are handled gracefully.

echo "Extract and compile translations"
if ! npm run translate:extract; then
  echo "Translation extraction failed" >&2
  exit 1
fi
if ! npm run translate:compile; then
  echo "Translation compilation failed" >&2
  exit 1
fi
git add "$MONOREPO_ROOT/packages/lib/translations/"
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "Extract and compile translations"
npm run translate:extract
npm run translate:compile
git add "$MONOREPO_ROOT/packages/lib/translations/"
echo "Extract and compile translations"
if ! npm run translate:extract; then
echo "Translation extraction failed" >&2
exit 1
fi
if ! npm run translate:compile; then
echo "Translation compilation failed" >&2
exit 1
fi
git add "$MONOREPO_ROOT/packages/lib/translations/"

Comment on lines +20 to +23
<Trans>
Our Enterprise License is great large organizations looking to switch to Documenso for all
their signing needs. It's availible for our cloud offering as well as self-hosted setups
and offer a wide range of compliance and Adminstration Features.

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.

Usage of Trans component in paragraph text is correct, but fix typographical errors.

The paragraph text is correctly wrapped in the Trans component for translation. However, there are typographical errors in the text:

  • "availible" should be "available"
  • "Adminstration" should be "Administration"
-          their signing needs. It's availible for our cloud offering as well as self-hosted setups
-          and offer a wide range of compliance and Adminstration Features.
+          their signing needs. It's available for our cloud offering as well as self-hosted setups
+          and offers a wide range of compliance and Administration Features.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Trans>
Our Enterprise License is great large organizations looking to switch to Documenso for all
their signing needs. It's availible for our cloud offering as well as self-hosted setups
and offer a wide range of compliance and Adminstration Features.
<Trans>
Our Enterprise License is great large organizations looking to switch to Documenso for all
their signing needs. It's available for our cloud offering as well as self-hosted setups
and offers a wide range of compliance and Administration Features.

Comment on lines +1 to +2
'use client';

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.

Remove unnecessary 'use client' directive.

The 'use client' directive is not required in this context.

- 'use client';
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'use client';

Comment on lines +17 to +22
const [i18n] = useState(() => {
return setupI18n({
locale: initialLocale,
messages: { [initialLocale]: initialMessages },
});
});

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.

Avoid creating i18n instance inside useState.

Creating the i18n instance inside useState can lead to unexpected behavior. Consider creating it outside the component.

const i18n = setupI18n({
  locale: initialLocale,
  messages: { [initialLocale]: initialMessages },
});

export function I18nClientProvider({
  children,
  initialLocale,
  initialMessages,
}: {
  children: React.ReactNode;
  initialLocale: string;
  initialMessages: Messages;
}) {
  return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const [i18n] = useState(() => {
return setupI18n({
locale: initialLocale,
messages: { [initialLocale]: initialMessages },
});
});
const i18n = setupI18n({
locale: initialLocale,
messages: { [initialLocale]: initialMessages },
});
export function I18nClientProvider({
children,
initialLocale,
initialMessages,
}: {
children: React.ReactNode;
initialLocale: string;
initialMessages: Messages;
}) {
return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
}

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9e82706 and 29d2b0c.

Files selected for processing (3)
  • .github/workflows/translations-pull.yml (4 hunks)
  • packages/lib/translations/de/marketing.js (1 hunks)
  • packages/lib/translations/de/marketing.po (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/lib/translations/de/marketing.js
Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/translations-pull.yml
  • packages/lib/translations/de/marketing.po

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 29d2b0c and 674b98b.

Files selected for processing (8)
  • .github/workflows/translations-force-pull.yml (1 hunks)
  • .github/workflows/translations-pull.yml (3 hunks)
  • packages/lib/constants/i18n.ts (1 hunks)
  • packages/lib/translations/ro/common.po (1 hunks)
  • packages/lib/translations/ro/marketing.js (1 hunks)
  • packages/lib/translations/ro/marketing.po (1 hunks)
  • packages/lib/translations/ro/web.js (1 hunks)
  • packages/lib/translations/ro/web.po (1 hunks)
Files skipped from review due to trivial changes (4)
  • packages/lib/constants/i18n.ts
  • packages/lib/translations/ro/common.po
  • packages/lib/translations/ro/web.js
  • packages/lib/translations/ro/web.po
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/translations-pull.yml
Additional comments not posted (7)
.github/workflows/translations-force-pull.yml (5)

1-8: LGTM!

The comments and workflow name are clear and appropriately descriptive.


9-16: LGTM!

The triggers and concurrency settings are appropriate and well-defined.


17-25: LGTM!

The job definitions and permissions are correctly set and appropriate for the workflow's purpose.


32-51: LGTM!

The steps for pulling translations from Crowdin are correctly configured and securely reference environment variables.


26-31: LGTM! Verify the custom action for Node.js installation.

The checkout step is correctly configured. Ensure the custom action for Node.js installation is secure and correctly implemented.

packages/lib/translations/ro/marketing.js (1)

1-1: LGTM! Verify the translations.

The translation strings are correctly formatted and consistent. Ensure the translations are verified by a native speaker or professional translator.

Verification successful

LGTM! Verify the translations.

The translation strings in the Romanian translation file are correctly formatted and consistent. Ensure the translations are verified by a native speaker or professional translator.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the translations in the Romanian language file.

# Test: Search for the Romanian language translation files. Expect: The translation strings are correctly formatted and consistent.
rg --type json -A 5 $'"Language": "ro"'

Length of output: 40


Script:

#!/bin/bash
# Locate the Romanian translation file and display its content for verification.

# Find the Romanian translation file in the translations directory.
fd -e js -e json -p 'ro' --exec cat

Length of output: 8001

packages/lib/translations/ro/marketing.po (1)

1-589: LGTM! Verify the translations.

The translation entries are correctly formatted and consistent. Ensure the translations are verified by a native speaker or professional translator.

Verification successful

LGTM! Verify the translations.

The translation entries in the Romanian language PO files are correctly formatted and consistent. Ensure the translations are verified by a native speaker or professional translator.

  • packages/lib/translations/ro/common.po
  • packages/lib/translations/ro/marketing.po
  • packages/lib/translations/ro/web.po
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the translations in the Romanian language PO file.

# Test: Search for the Romanian language PO translation files. Expect: The translation entries are correctly formatted and consistent.
rg --type po -A 5 $'"Language: ro"'

Length of output: 36


Script:

#!/bin/bash
# Description: Locate all PO files and inspect the content of the Romanian language PO file.

# Locate all PO files in the repository.
fd -e po

# Inspect the content of the Romanian language PO file.
fd -e po | xargs grep -A 5 'Language: ro'

Length of output: 1515

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 674b98b and f8d33e4.

Files selected for processing (1)
  • crowdin.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • crowdin.yml

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f8d33e4 and a662073.

Files selected for processing (4)
  • packages/lib/translations/ro/common.po (1 hunks)
  • packages/lib/translations/ro/marketing.js (1 hunks)
  • packages/lib/translations/ro/marketing.po (1 hunks)
  • packages/lib/translations/ro/web.po (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • packages/lib/translations/ro/common.po
  • packages/lib/translations/ro/marketing.js
  • packages/lib/translations/ro/marketing.po
  • packages/lib/translations/ro/web.po

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a662073 and 192799f.

Files selected for processing (2)
  • packages/lib/translations/ro/marketing.js (1 hunks)
  • packages/lib/translations/ro/marketing.po (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • packages/lib/translations/ro/marketing.js
  • packages/lib/translations/ro/marketing.po


#: apps/marketing/src/app/(marketing)/open/page.tsx:165
msgid "All our metrics, finances, and learnings are public. We believe in transparency and want to share our journey with you. You can read more about why here: <0>Announcing Open Metrics</0>"
msgstr "Toate metricile, finanțele și învățămintele noastre sunt publice. Credem în transparență și dorim să împărtășim călătoria noastră cu tine. Poți citi mai multe despre asta aici: <0>Anunțând Metriile Deschise</0>"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it should be "<0>Anunțând Metricile Deschise</0>"


#: apps/marketing/src/components/(marketing)/share-connect-paid-widget-bento.tsx:106
msgid "Easily embed Documenso into your product. Simply copy and paste our react widget into your application."
msgstr "Incorporați ușor Documenso în produsul dvs. Pur și simplu copiați și lipiți widget-ul nostru react în aplicația dvs."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"adaugati" instead of "lipiti"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"react" should be "React" in both cases I guess


#: apps/marketing/src/app/(marketing)/pricing/page.tsx:177
msgid "Why should I prefer Documenso over DocuSign or some other signing tool?"
msgstr "De ce ar trebui să prefer Documenso în locul DocuSign sau altui instrument de semnare?"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

De ce sa alegi Documenso in locul altor instrumente de semnatura digitala? sounds better.


#: apps/marketing/src/components/(marketing)/open-build-template-bento.tsx:81
msgid "Choose a template from the community app store. Or submit your own template for others to use."
msgstr "Alegeți un șablon din magazinul de aplicații al comunității. Sau trimiteți propriul șablon pentru ca alții să îl folosească."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

adaugati instead of trimiteti


#: apps/marketing/src/components/(marketing)/share-connect-paid-widget-bento.tsx:63
msgid "Create connections and automations with Zapier and more to integrate with your favorite tools."
msgstr "Creați conexiuni și automatizări cu Zapier și altele pentru a integra cu instrumentele dvs. preferate."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this would sound better as "Creați conexiuni și automatizări cu Zapier și altele pentru a integra Documenso cu aplicatiile dvs. preferate."


#: apps/marketing/src/components/(marketing)/share-connect-paid-widget-bento.tsx:85
msgid "Integrated payments with Stripe so you don’t have to worry about getting paid."
msgstr "Plăți integrate cu Stripe astfel încât să nu trebuiască să te îngrijorezi de a primi banii."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Plăți integrate cu Stripe astfel încât să nu trebuiască să te îngrijorezi cu plățile"


#: apps/marketing/src/app/(marketing)/open/page.tsx:289
msgid "Is there more?"
msgstr "Mai e ceva?"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Mai mult?"


#: apps/marketing/src/components/(marketing)/share-connect-paid-widget-bento.tsx:31
msgid "Integrates with all your favourite tools."
msgstr "Se integrează cu toate uneltele tale preferate."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Se integrează cu toate aplicatiile tale preferate.


#: apps/marketing/src/components/(marketing)/open-build-template-bento.tsx:40
msgid "It’s up to you. Either clone our repository or rely on our easy to use hosting solution."
msgstr "Depinde de tine. Fie clonezi depozitul nostru, fie te bazezi pe soluția noastră ușor de utilizat de găzduire."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Alegerea este a ta. Fie îți găzduiești singur aplicația, fie lași în grija noastră toate detaliile de găzduire."


#: apps/marketing/src/app/(marketing)/pricing/page.tsx:93
msgid "You can self-host Documenso for free or use our ready-to-use hosted version. The hosted version comes with additional support, painless scalability and more. Early adopters will get access to all features we build this year, for no additional cost! Forever! Yes, that includes multiple users per account later. If you want Documenso for your enterprise, we are happy to talk about your needs."
msgstr "Poți găzdui Documenso pe cont propriu gratuit sau să folosești versiunea noastră găzduită gata de utilizare. Versiunea găzduită vine cu suport suplimentar, scalabilitate fără dureri și multe altele. Utilizatorii timpurii vor avea acces la toate funcțiile pe care le construim în acest an, fără costuri suplimentare! Pentru totdeauna! Da, aceasta include utilizatori multipli pe cont mai târziu. Dacă dorești Documenso pentru întreprinderea ta, suntem bucuroși să discutăm despre nevoile tale."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TODO: add more

@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: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 192799f and 8ff756a.

Files selected for processing (3)
  • apps/marketing/src/app/layout.tsx (4 hunks)
  • packages/lib/client-only/providers/i18n.server.tsx (1 hunks)
  • packages/lib/constants/i18n.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • apps/marketing/src/app/layout.tsx
  • packages/lib/constants/i18n.ts
Additional context used
Biome
packages/lib/client-only/providers/i18n.server.tsx

[error] 31-31: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)


[error] 45-45: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Additional comments not posted (3)
packages/lib/client-only/providers/i18n.server.tsx (3)

15-25: LGTM!

The function loadCatalog correctly imports and returns the messages for the specified locale.


27-27: LGTM!

The code block correctly uses Promise.all to load the catalogs for all supported language codes.


53-68: LGTM!

The function setupI18nSSR correctly sets up the i18n instance for server-side rendering based on the specified language.

Comment on lines +30 to +32
export const allMessages = catalogs.reduce((acc, oneCatalog) => {
return { ...acc, ...oneCatalog };
}, {});

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.

Avoid spread syntax on accumulators for better performance.

Using spread syntax on accumulators causes a time complexity of O(n^2). Consider using Object.assign instead.

-  return { ...acc, ...oneCatalog };
+  return Object.assign(acc, oneCatalog);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const allMessages = catalogs.reduce((acc, oneCatalog) => {
return { ...acc, ...oneCatalog };
}, {});
export const allMessages = catalogs.reduce((acc, oneCatalog) => {
return Object.assign(acc, oneCatalog);
}, {});
Tools
Biome

[error] 31-31: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Comment on lines +37 to +46
export const allI18nInstances = SUPPORTED_LANGUAGE_CODES.reduce((acc, locale) => {
const messages = allMessages[locale] ?? {};

const i18n = setupI18n({
locale,
messages: { [locale]: messages },
});

return { ...acc, [locale]: i18n };
}, {}) as AllI18nInstances;

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.

Avoid spread syntax on accumulators for better performance.

Using spread syntax on accumulators causes a time complexity of O(n^2). Consider directly assigning to the accumulator object instead.

-  return { ...acc, [locale]: i18n };
+  acc[locale] = i18n;
+  return acc;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const allI18nInstances = SUPPORTED_LANGUAGE_CODES.reduce((acc, locale) => {
const messages = allMessages[locale] ?? {};
const i18n = setupI18n({
locale,
messages: { [locale]: messages },
});
return { ...acc, [locale]: i18n };
}, {}) as AllI18nInstances;
export const allI18nInstances = SUPPORTED_LANGUAGE_CODES.reduce((acc, locale) => {
const messages = allMessages[locale] ?? {};
const i18n = setupI18n({
locale,
messages: { [locale]: messages },
});
acc[locale] = i18n;
return acc;
}, {}) as AllI18nInstances;
Tools
Biome

[error] 45-45: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8ff756a and 7447e06.

Files selected for processing (5)
  • apps/marketing/src/components/(marketing)/enterprise.tsx (3 hunks)
  • packages/lib/translations/de/marketing.js (1 hunks)
  • packages/lib/translations/de/marketing.po (1 hunks)
  • packages/lib/translations/en/marketing.js (1 hunks)
  • packages/lib/translations/en/marketing.po (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/lib/translations/en/marketing.js
Files skipped from review as they are similar to previous changes (4)
  • apps/marketing/src/components/(marketing)/enterprise.tsx
  • packages/lib/translations/de/marketing.js
  • packages/lib/translations/de/marketing.po
  • packages/lib/translations/en/marketing.po

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7447e06 and ef91146.

Files selected for processing (1)
  • apps/marketing/src/app/layout.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/marketing/src/app/layout.tsx

This branch was successfully deployed

4 active and 1 inactive (outdated) deployments
Preview – stg-docs — ef911461 Deployed Jul 26, 2024 by vercel[bot]
Preview – stg-app — ef911461 Deployed Jul 26, 2024 by vercel[bot]
Preview – stg-marketing — ef911461 Deployed Jul 26, 2024 by vercel[bot]
Preview – prd-docs — ef911461 Deployed Jul 26, 2024 by vercel[bot]
Translations — f8d33e4a Deployed Jul 25, 2024 by dguyen
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 🚨 migrations 🚨 Be advised: PR contains database migrations - Auto-Generated by GitHub Actions on raising a PR version bump 👀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants