Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templates modal pt-BR translation #1120

Conversation

gabrielgpavao
Copy link
Contributor

@gabrielgpavao gabrielgpavao commented Dec 25, 2023

Summary by CodeRabbit

  • New Features

    • Templates now support multiple languages with the introduction of a translation function for template names, descriptions, and category tags.
  • Enhancements

    • Improved template naming consistency with capitalization adjustments for clarity.

Copy link

vercel bot commented Dec 25, 2023

@gabrielgpavao is attempting to deploy a commit to the Typebot Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

coderabbitai bot commented Dec 25, 2023

Walkthrough

The recent update involves internationalization enhancements in the TemplatesModal component, where translation functions are now utilized for template names, descriptions, and category tags. Additionally, there has been a standardization effort in naming conventions, with template names in the data.ts file being capitalized for improved consistency and clarity.

Changes

Files Change Summary
.../templates/components/TemplatesModal.tsx
.../templates/data.ts
Integrated translation functions for template metadata in TemplatesModal. Capitalized template names for naming consistency in data.ts.
.vscode/settings.json Updated i18n-ally localesPaths setting.
.../templates/hooks/useTemplates.ts Introduced useTemplates function returning array of template objects with localized names and descriptions.

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 with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3bbaf67 and 2be9dbf.
Files ignored due to filter (2)
  • apps/builder/public/locales/en.json
  • apps/builder/public/locales/pt-BR.json
Files selected for processing (2)
  • apps/builder/src/features/templates/components/TemplatesModal.tsx (5 hunks)
  • apps/builder/src/features/templates/data.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • apps/builder/src/features/templates/data.ts
Additional comments: 4
apps/builder/src/features/templates/components/TemplatesModal.tsx (4)
  • 115-122: Ensure that the translation keys generated by createTranslationKey are correctly mapped in the translation files. Missing or incorrect keys could lead to display issues for the end-users.

  • 159-166: The translation function is used here similarly to the previous hunk. It's important to verify that the translations for these keys are provided for all supported languages to maintain a consistent user experience.

  • 203-210: As with the previous instances, verify that the translation keys generated here are present in the translation files. Additionally, ensure that the fallback text (template.name) is appropriate and that it should not be translated or formatted differently.

  • 252-270: The translation keys for the selected template's name and description are generated here. It's crucial to ensure that the keys correspond to actual entries in the translation files and that the fallbacks are suitable for display in case translations are missing.

Copy link
Owner

Choose a reason for hiding this comment

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

@gabrielgpavao

It's preferable to avoid getting translations by creating a key dynamically like you did.

Feel free to review this modification :)

@baptisteArno baptisteArno merged commit 5124373 into baptisteArno:main Dec 29, 2023
1 of 4 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2be9dbf and 8b4504f.
Files ignored due to filter (3)
  • apps/builder/src/i18n/en.json
  • apps/builder/src/i18n/fr.json
  • apps/builder/src/i18n/pt-BR.json
Files selected for processing (3)
  • .vscode/settings.json (1 hunks)
  • apps/builder/src/features/templates/components/TemplatesModal.tsx (3 hunks)
  • apps/builder/src/features/templates/hooks/useTemplates.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • .vscode/settings.json
Additional comments: 5
apps/builder/src/features/templates/hooks/useTemplates.ts (1)
  • 4-127: The useTemplates hook uses the useTranslate hook to provide translations for template properties. Ensure that the translation keys are correctly named and that they correspond to actual translations in the localization files. Additionally, consider adding error handling for translation failures to improve robustness.
apps/builder/src/features/templates/components/TemplatesModal.tsx (4)
  • 18-18: The import statement for useTemplates has been added correctly. Ensure that the useTemplates hook is being used in accordance with the expected behavior and that the typebot state management aligns with the application's state management strategy.

  • 40-43: Initialization of the templates variable using the useTemplates hook is correct. However, ensure that the default state for selectedTemplate is handled correctly in case the templates array is empty.

  • 54-54: The modification to the setTypebot function to include the name property from the template is a good addition for maintaining the context of the selected template. Ensure that this change is reflected wherever the typebot state is utilized.

  • 60-62: The addition of a condition in the useEffect hook to prevent refetching the template if typebot is already set is a good practice to avoid unnecessary network requests. Verify that this change does not introduce any unintended side effects, especially in scenarios where the typebot might need to be refreshed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants