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

🌍 i18n: Add multi-language support for Terms of Service #6267

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rubentalstra
Copy link
Collaborator

Summary

This pull request includes significant updates to the terms and conditions functionality in the application. The changes involve refactoring the TermsAndConditionsModal component, integrating language-specific terms content, and updating the configuration and schema to support these changes.

Refactoring and Component Updates:

Language-Specific Terms Content:

  • client/src/routes/Root.tsx: Integrated the getTermsMarkdown function to dynamically fetch terms content based on the user's language setting using Recoil state management. [1] [2] [3]
  • client/src/terms/termsContent.ts: Added a new module to manage language-specific terms content and a function to retrieve the appropriate markdown content based on the user's language.
  • Added terms content in English, German, and French in markdown files. [1] [2] [3]

Configuration and Schema Updates:

Change Type

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Testing

Please describe your test process and include instructions so that we can reproduce your test. If there are any important variables for your testing configuration, list them here.

Test Configuration:

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.
  • A pull request for updating the documentation has been submitted.

@rubentalstra rubentalstra added ✨ enhancement New feature or request 🌍 i18n Language labels Mar 10, 2025
@rubentalstra rubentalstra self-assigned this Mar 10, 2025
@rubentalstra rubentalstra added this to the v0.7.8 milestone Mar 10, 2025
@maxesse
Copy link
Contributor

maxesse commented Mar 10, 2025

I have implemented this at my end, but kept it all within the yaml config, basically like this:

    #-----------------------------------------
    # Terms of Service Content Translations
    #-----------------------------------------
    modalContent:

      #-----------------------------------------
      # Default
      #-----------------------------------------
      default: |
        Terms go here
      #-----------------------------------------
      # English translation
      #-----------------------------------------
      "en-US": |
        Terms go here
      #-----------------------------------------
      # German translation
      #-----------------------------------------
      "de-DE": |
        Terms go here

Your implementation is definitely more elegant and doesn't make librechat.yaml become a monster. My only concern is, how would you foresee people customising them with the new system? Would the terms folder be mounted as a docker volume? Or would they have to bake a custom image? My method lets you use the standard docker image without customisations if you wish. But if we mount the terms folder as a docker volume, the .ts file in it should probably be moved elsewhere?
Not bashing or anything, just wanted to understand how you see it implemented broadly :)

@rubentalstra
Copy link
Collaborator Author

@maxesse thank you for your feedback, I thought about implementing it in the yaml file. but I want to avoid to create a monster of a config file. and doing it this way it's more dynamic. I understand for the docker scenario. this was first for me just a PoC but I will move the .md files outside of the client folder so this can be mounted for docker.

and the ToS are not updated every week right 😉

@rubentalstra rubentalstra marked this pull request as draft March 10, 2025 09:04
@maxesse
Copy link
Contributor

maxesse commented Mar 10, 2025

Yes for sure - and as far as i'm concerned it doesn't really matter, I'm happy to either bake an image or to add a folder as a volume to K8S, I only wanted to understand which direction you preferred :)

@maxesse
Copy link
Contributor

maxesse commented Mar 10, 2025

tbh i'll be glad to take it out of the yaml, between the translated terms and the translated modelSpecs, i have a 70kb file (hence why i have those chonky section dividers, or i lose myself in it)

@rubentalstra
Copy link
Collaborator Author

rubentalstra commented Mar 10, 2025

I'm happy that you like it. and thanks for the heads up regarding docker images. good one 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request 🌍 i18n Language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants