massenergize / api

Backend Code for Massenergize Portal. This provides the API to the backend database, and is shared by the various front-end portal projects.
MIT License
4 stars 8 forks source link

feat: add site translation models #1091

Open archx3 opened 1 week ago

archx3 commented 1 week ago

Summary / Highlights

Addresses #1085

Details (Give details about what this PR accomplishes, include any screenshots etc)

This pull request introduces the following changes:

  1. Addition of two new classes to the database models: ManualCommunityTranslation and StaticSiteText. This includes necessary cleanup of white space inconsistencies.
  2. Introduction of a new model, CommunitySupportedLanguage, that links Communities with SupportedLanguages via foreign keys. This is a significant step towards managing the languages supported by different communities on our platform.
  3. Addition of the TranslationsCache model. This model represents translation data with attributes including hash, source_language_code, target_language_code, translated_text, and last_translated, and includes JSON methods for serialization.
  4. Creation of the TextHash model. This new database model has key attributes of hash and text, with the hash being a unique primary key.
  5. Introduction of the SupportedLanguage class which represents the languages supported by our platform. This update also included minor code cleanups for readability and maintainability.
  6. Addition of a new constant for language code string length. This included a refactor of the base model to create a new RootModel with common fields and methods, which contributes to reducing code duplication and increasing modularity.

Testing Steps (Provide details on how your changes can be tested)

Requirements (place an x in each [ ])

Transparency (Project board)