Repository navigation
feat: initial i18n marketing implementation - #1223
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis 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
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
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
5443c86 to
3d49c4a
Compare
Co-authored-by: Crowdin Bot <[email protected]>
There was a problem hiding this comment.
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
switchI18NLanguagefunction./** * 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
I18nClientProvidercomponent./** * 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 withenvironmentKey UsageThe
environmentkey is not found in the GitHub Actions workflow files but is present in various Docker Compose files. This suggests that the addition ofenvironment: Translationsin the.github/workflows/translations-upload.ymlfile might be incorrect or misplaced. Please verify the correct usage of theenvironmentkey in GitHub Actions workflows.
.github/workflows/translations-upload.yml: Line 17Analysis 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/1j9aoC2POOFK2YvdxE32yG8y4McJfQ4yiZOB5lWFkC652R6j6C9AxJ6YtxFj6zNyfI77/8W27FPIvI7zGun78AKApo8GpyFt8Zy3YU8e4lIo9VGuMA9mkNAnAvYbULBOV7DDCAL6E9CHzOWBCWe7wBCsm+TNCtgXe4F9564XFNv8t7GDvlUTGE1BlAGHelWdGNfoAOHEDnIDI2ufwSIAq/yrIPgkVQJ/hVSQJZbmjLK6KbY4KM6m8pLOyqaCMHrjPMNApCXaOIowgOOWsQIeOYoVNkOpNhRnR1aJ0WRkUXMmStoBffTvY/XAV+D/YPV6EY8BW/TUoXW2nDs0W6qD1TWMfAK8XYLcNvXi7f+zXkF8tvYcfUZ9ZDIydzZSW8idZaMyxUaLD+TdaSWzT9aoDa18astDB+b76QYobPpoCbc3b0B0cT9Z9ecVPDPtchL5IGe+RpCPeK0veReSfS30f3Botnf8fH8WfByw/gfxgcNVgBefbzigwAqTjjAtjQk/ANikkV0qBqlm5v+6mgQhDSp5+XQNpF9qThpS8wejpfjrI2phSPy7qJVkX+qOMroCrKtmiDrjGI/Qrr83qKrzQpexsXswT6sib3h3tSS7hjtkQ/WIu0zktAvERlcdvXBVQZvaHmllvb0Q0/vdAd7cwJijgUy2DcZjy2dGtUz5kV0hzkWmBhPlease 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
jqcommand 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.jsLength 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.jsLength 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.jsLength 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.jsonLength 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.jsonLength of output: 3637
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
package-lock.jsonis 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 ofO(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 ofO(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:extractandtranslate:compilecommands 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
SupportedLanguageCodesis accurate and leverages TypeScript'sas constassertion effectively.
5-8: Config object is well-defined.The
APP_I18N_OPTIONSobject is well-structured and usesas constto ensure immutability.
10-13: Type definition forSupportedLanguageis clear and appropriate.The
SupportedLanguagetype is straightforward and accurately represents the structure of supported languages.
15-24: Ensure all supported languages are included.The
SUPPORTED_LANGUAGESobject 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
LinguiConfigtype from@lingui/conf.
3-3: Import statement is correct.The import statement correctly imports
APP_I18N_OPTIONSfrom 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
localesis 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
catalogsMergePathis correctly set to merge translations for the web application.
22-22: Export statement is correct.The export statement correctly exports the
configobject as the default export.apps/marketing/lingui.config.ts (7)
1-1: Import statement is correct.The import statement correctly imports the
LinguiConfigtype from@lingui/conf.
3-3: Import statement is correct.The import statement correctly imports
APP_I18N_OPTIONSfrom 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
localesis 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
catalogsMergePathis correctly set to merge translations for the marketing application.
22-22: Export statement is correct.The export statement correctly exports the
configobject 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 forTranscomponent is correct.The import statement correctly brings in the
Transcomponent from the@lingui/macropackage.
16-16: Usage ofTranscomponent in header text is correct.The header text "Enterprise Compliance, License or Technical Needs?" is correctly wrapped in the
Transcomponent for translation.
35-35: Usage ofTranscomponent in button text is correct.The button text "Contact Us" is correctly wrapped in the
Transcomponent for translation.apps/marketing/src/components/(marketing)/call-to-action.tsx (4)
3-3: Import statement forTranscomponent is correct.The import statement correctly brings in the
Transcomponent from the@lingui/macropackage.
19-19: Usage ofTranscomponent in header text is correct.The header text "Join the Open Signing Movement" is correctly wrapped in the
Transcomponent for translation.
23-26: Usage ofTranscomponent in paragraph text is correct.The paragraph text is correctly wrapped in the
Transcomponent for translation.
31-31: Usage ofTranscomponent in button text is correct.The button text "Get started" is correctly wrapped in the
Transcomponent for translation.apps/marketing/src/app/(marketing)/open/typefully.tsx (5)
7-7: Import statement forTranscomponent is correct.The import statement correctly brings in the
Transcomponent from the@lingui/macropackage.
20-20: Usage ofTranscomponent in header text is correct.The header text "Twitter Stats" is correctly wrapped in the
Transcomponent for translation.
28-29: Usage ofTranscomponent in link text is correct.The link text "Documenso on X" is correctly wrapped in the
Transcomponent for translation.
33-33: Usage ofTranscomponent in button text is correct.The button text "View all stats" is correctly wrapped in the
Transcomponent for translation.
38-38: Usage ofTranscomponent in button text is correct.The button text "Follow us on X" is correctly wrapped in the
Transcomponent for translation.apps/marketing/src/components/(marketing)/callout.tsx (2)
5-5: Import statement approved.The import of the
Transcomponent from@lingui/macrois correct and necessary for internationalization.
27-29: Internationalization support added.The use of the
Transcomponent from@lingui/macrofor 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
setupI18nSSRfunction from@documenso/lib/client-only/providers/i18n.serveris correct and necessary for internationalization.
29-30: Internationalization support added.The addition of the
setupI18nSSRfunction 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_translationsjob is correct and helps in context-specific configurations or permissions.
49-49: Environment variable update approved.The update to the environment variable
GITHUB_TOKENfromsecrets.GITHUB_CROWDIN_TOKENtosecrets.GH_PATis correct and likely enhances security or complies with updated practices.apps/marketing/src/app/(marketing)/open/tooltip.tsx (2)
3-3: Import statement forTranscomponent is correct.The import statement for the
Transcomponent from@lingui/macrois necessary for internationalization.
34-36: Usage ofTranscomponent 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-pluginare 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 forTrans,msg, anduseLinguiare correct.The import statements for
Trans,msg, anduseLinguifrom@lingui/macroand@lingui/reactare necessary for internationalization.
16-17: Usage ofuseLinguihook is correct.The
useLinguihook is correctly used to access the translation function_.
29-31: Usage ofTranscomponent 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
pushevent trigger is configured to trigger on pushes to themainbranch, as expected. Here is the relevant snippet from the.github/workflows/translations-upload.ymlfile:
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.ymlLength 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
TransanduseLinguiare correctly added from@lingui/macroand@lingui/react.
19-20: Usage ofuseLinguihook looks good.The
useLinguihook is correctly used to access the translation function_.
33-34: Usage ofTranscomponent looks good.The static string "Completed Documents per Month" is correctly replaced with the
Transcomponent 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
TransanduseLinguiare correctly added from@lingui/macroand@lingui/react.
16-17: Usage ofuseLinguihook looks good.The
useLinguihook is correctly used to access the translation function_.
30-31: Usage ofTranscomponent looks good.The static string "Total Completed Documents" is correctly replaced with the
Transcomponent 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,cookiesfromnext/headers, and various Lingui-related imports are correctly added.
15-25: FunctionloadCatalogimplementation looks good.The function correctly loads translation catalogs based on the locale and application type.
53-66: FunctionsetupI18nSSRimplementation 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:compilescript 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-pluginare 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
TransanduseLinguiare necessary for the localization implementation.
21-22: LGTM! The localization is correctly implemented.The use of
useLinguiandTranscomponents for localization is appropriate and aligns with the project's needs.
25-27: LGTM! The JSX elements are correctly wrapped withTranscomponents.The wrapping of JSX elements with
Transcomponents 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, andCommandDialogare necessary for the language switcher component.
25-37: LGTM! The function is correctly implemented.The
I18nSwitcherfunction 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: Importmsgfunction for i18n.The
msgfunction from@lingui/macrois correctly imported for internationalization.
9-9: Integratemsgfunction for engagement property.The
engagementproperty is correctly wrapped with themsgfunction 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: ImportTranscomponent anduseLinguihook for i18n.The
Transcomponent anduseLinguihook from@lingui/macroand@lingui/reactare correctly imported for internationalization.
16-17: UseuseLinguihook for i18n.The
useLinguihook is correctly used to get the_function for internationalization.
28-30: Wrap text withTranscomponent for i18n.The text "Total Funding Raised" is correctly wrapped with the
Transcomponent 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: ImportTranscomponent for i18n.The
Transcomponent from@lingui/macrois correctly imported for internationalization.
42-42: Wrap text withTranscomponent for i18n.The text "Pricing", "Blog", "Open Startup", "Sign in", and "Sign up" are correctly wrapped with the
Transcomponent for internationalization.Also applies to: 57-57, 64-64, 72-72, 77-77
apps/web/next.config.js (2)
34-34: LGTM! The addition ofswcPluginsaligns with the Lingui library usage.The
swcPluginsproperty in theexperimentalconfiguration correctly specifies the use of the@lingui/swc-plugin.
63-68: LGTM! The new Webpack rule for processing.pofiles is correctly configured.The rule addition to the
module.rulesarray ensures that.pofiles are processed using the@lingui/loader, aligning with the Lingui library's requirements.apps/marketing/next.config.js (2)
33-33: LGTM! The addition ofswcPluginsaligns with the Lingui library usage.The
swcPluginsproperty in theexperimentalconfiguration correctly specifies the use of the@lingui/swc-plugin.
59-64: LGTM! The new Webpack rule for processing.pofiles is correctly configured.The rule addition to the
module.rulesarray ensures that.pofiles 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 theTranscomponent is correct.The
Transcomponent from@lingui/macrois correctly imported for internationalization support.
6-6: LGTM! ThesetupI18nSSRfunction call is correctly implemented.The
setupI18nSSRfunction initializes i18n support, and the extractedi18nobject is used within the component.Also applies to: 13-13
25-27: LGTM! TheTranscomponent is correctly used for text translation.The
Transcomponent 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: Scripttranslate:extractadded successfully.The script
translate:extractuseslingui extractto extract translations, aligning with the PR objectives.
36-36: Scripttranslate:compileadded successfully.The script
translate:compileusesturbo runwith appropriate filters to compile translations, aligning with the PR objectives.
46-46: DevDependency@lingui/cliadded successfully.The devDependency
@lingui/cliis added with version4.11.1, supporting the translation extraction script.
66-66: Dependency@lingui/coreadded successfully.The dependency
@lingui/coreis added with version4.11.1, supporting the translation functionalities.apps/marketing/src/components/(marketing)/open-build-template-bento.tsx (5)
5-5: ImportedTranscomponent successfully.The
Transcomponent from@lingui/macrois imported to support internationalization, aligning with the PR objectives.
27-30: Heading text wrapped inTranscomponent.The heading text is correctly wrapped in the
Transcomponent, supporting internationalization.
37-43: First card content wrapped inTranscomponent.The first card content is correctly wrapped in the
Transcomponent, supporting internationalization.
59-62: Second card content wrapped inTranscomponent.The second card content is correctly wrapped in the
Transcomponent, supporting internationalization.
78-84: Third card content wrapped inTranscomponent.The third card content is correctly wrapped in the
Transcomponent, supporting internationalization.apps/marketing/src/components/(marketing)/footer.tsx (5)
8-9: ImportedmsganduseLinguisuccessfully.The
msgfunction from@lingui/macroanduseLinguihook from@lingui/reactare imported to support internationalization, aligning with the PR objectives.
18-18: ImportedI18nSwitchercomponent successfully.The
I18nSwitchercomponent is imported to support language switching, aligning with the PR objectives.
31-43: Footer links wrapped inmsgfunction.The footer link text is correctly wrapped in the
msgfunction, supporting internationalization.
47-47:useLinguihook used successfully.The
useLinguihook is used to dynamically retrieve translated strings, supporting internationalization.
100-101:I18nSwitchercomponent added to the footer.The
I18nSwitchercomponent 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
msganduseLinguiare necessary for the internationalization changes.
24-61: Internationalization of navigation links looks good.The
textvalues inMENU_NAVIGATION_LINKSare correctly updated to usemsgfor localization.
66-67: Usage ofuseLinguihook looks good.The
useLinguihook 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-stringtextvalues, ensuring proper localization.apps/marketing/src/components/(marketing)/faster-smarter-beautiful-bento.tsx (5)
5-6: Import forTranslooks good.The import for
Transfrom@lingui/macrois 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
I18nClientProviderandsetupI18nSSRare necessary for the internationalization changes.
59-60: Usage ofsetupI18nSSRfunction looks good.The
setupI18nSSRfunction is correctly used to retrieve the current language and i18n messages.
63-63: Dynamiclangattribute looks good.The
langattribute 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 ofI18nClientProviderlooks good.The
I18nClientProvidercorrectly 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
Transcomponent from the@lingui/macrolibrary is appropriate for the internationalization implementation.
100-104: Correct usage of theTranscomponent for internationalization.The text elements within the
Herocomponent are correctly wrapped in theTranscomponent for internationalization.
119-121: Correct usage of theTranscomponent for internationalization.The text elements within the
Buttoncomponent are correctly wrapped in theTranscomponent for internationalization.
128-128: Correct usage of theTranscomponent for internationalization.The text element within the
Buttoncomponent for the GitHub link is correctly wrapped in theTranscomponent for internationalization.apps/marketing/src/components/(marketing)/share-connect-paid-widget-bento.tsx (6)
5-5: LGTM!The import statement for the
Transcomponent from the@lingui/macrolibrary is appropriate for the internationalization implementation.
31-34: Correct usage of theTranscomponent for internationalization.The text elements within the
h2tag are correctly wrapped in theTranscomponent for internationalization.
41-44: Correct usage of theTranscomponent for internationalization.The text elements within the
CardContentcomponent are correctly wrapped in theTranscomponent for internationalization.
60-66: Correct usage of theTranscomponent for internationalization.The text elements within the
CardContentcomponent are correctly wrapped in theTranscomponent for internationalization.
82-87: Correct usage of theTranscomponent for internationalization.The text elements within the
CardContentcomponent are correctly wrapped in theTranscomponent for internationalization.
103-109: Correct usage of theTranscomponent for internationalization.The text elements within the
CardContentcomponent are correctly wrapped in theTranscomponent for internationalization.apps/marketing/src/components/(marketing)/pricing-table.tsx (11)
8-8: Import statement forTranscomponent is correct.The import statement for the
Transcomponent from@lingui/macrois 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.exportsto 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 forTrans,msg, anduseLinguiare correct.The import statements for
Trans,msg, anduseLinguifrom@lingui/macroand@lingui/reactare necessary and correctly added.
19-19: Correct usage ofmsgfunction for "Signing Process".The text "Signing Process" is correctly wrapped in the
msgfunction for localization.
25-25: Correct usage ofmsgfunction for "Teams".The text "Teams" is correctly wrapped in the
msgfunction for localization.
37-37: Correct usage ofmsgfunction for "Direct Link".The text "Direct Link" is correctly wrapped in the
msgfunction for localization.
55-55: Correct usage ofmsgfunction for "Profile".The text "Profile" is correctly wrapped in the
msgfunction for localization.
63-63: Correct usage ofuseLinguihook.The
useLinguihook is correctly used to access the translation function for dynamic translation.
93-96: Improved control flow inonThumbClickfunction.The control flow adjustments improve readability and maintainability.
103-106: Improved control flow inonSelectfunction.The control flow adjustments improve readability and maintainability.
112-114: Correct type assertion forautoplayplugin.The type assertion for the
autoplayplugin 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 oftypeofcheck for slide labels.The
typeofcheck 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
TransandsetupI18nSSRare 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: EnsuresetupI18nSSRis correctly initialized.The
setupI18nSSRfunction is called to initialize server-side internationalization. Verify that this function is correctly implemented and necessary for thePricingPage.Verification successful
Let's gather more information by performing a broader search for the
setupI18nSSRfunction implementation.
To ensure the
setupI18nSSRfunction is correctly implemented, let's extract its full implementation.
The
setupI18nSSRfunction is correctly implemented and necessary for thePricingPageto 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 2Length 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.tsxLength 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, andsetupI18nSSRare appropriate for the i18n implementation.Also applies to: 7-7
160-162: LGTM! Text wrapping with<Trans>andmsgis correct.The static text is correctly wrapped in
<Trans>components and dynamic text uses themsgfunction 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: EnsuresetupI18nSSRis correctly initialized.The
setupI18nSSRfunction is called to initialize server-side internationalization. Verify that this function is correctly implemented and necessary for theOpenPage.Verification successful
Ensure
setupI18nSSRis correctly initialized.The
setupI18nSSRfunction 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.
setupI18nSSRis defined inpackages/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.tsxLength of output: 362
136-136: EnsureuseLinguihook is correctly used.The
useLinguihook is used to access the i18n context. Verify that this hook is correctly implemented and necessary for theOpenPage.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.poare 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.poLength of output: 15233
| 'use server'; | ||
|
|
There was a problem hiding this comment.
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.
| 'use server'; |
| // eslint-disable-next-line @typescript-eslint/require-await | ||
| export const switchI18NLanguage = async (lang: string) => { | ||
| cookies().set('i18n', lang); |
There was a problem hiding this comment.
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.
| // 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); | |
| } | |
| }; |
| echo "Extract and compile translations" | ||
| npm run translate:extract | ||
| npm run translate:compile | ||
| git add "$MONOREPO_ROOT/packages/lib/translations/" |
There was a problem hiding this comment.
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.
| 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/" |
| <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. |
There was a problem hiding this comment.
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.
| <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. |
| 'use client'; | ||
|
|
There was a problem hiding this comment.
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.
| 'use client'; |
| const [i18n] = useState(() => { | ||
| return setupI18n({ | ||
| locale: initialLocale, | ||
| messages: { [initialLocale]: initialMessages }, | ||
| }); | ||
| }); |
There was a problem hiding this comment.
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.
| 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>; | |
| } |
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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 catLength 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
Co-authored-by: Crowdin Bot <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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>" |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
"adaugati" instead of "lipiti"
There was a problem hiding this comment.
"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?" |
There was a problem hiding this comment.
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ă." |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
"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?" |
|
|
||
| #: 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." |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
"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." |
There was a problem hiding this comment.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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 ofO(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 ofO(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
loadCatalogcorrectly imports and returns the messages for the specified locale.
27-27: LGTM!The code block correctly uses
Promise.allto load the catalogs for all supported language codes.
53-68: LGTM!The function
setupI18nSSRcorrectly sets up the i18n instance for server-side rendering based on the specified language.
| export const allMessages = catalogs.reduce((acc, oneCatalog) => { | ||
| return { ...acc, ...oneCatalog }; | ||
| }, {}); |
There was a problem hiding this comment.
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.
| 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 ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
| 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; |
There was a problem hiding this comment.
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.
| 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 ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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
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:
t('some-text')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
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:
This means we want to separate translations into:
apps/marketingapps/webpackages/constantsandpackages/uiThen we bundle, compile and minify the translations for production as follows:
This allows us to only load the required translations when running each application.
Overall general changes:
Summary by CodeRabbit
New Features
<meta>tag to prevent Google from translating the page content, supporting internationalization efforts.Bug Fixes
Chores