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

Implement i18n support #243

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

rypptc
Copy link
Contributor

@rypptc rypptc commented Oct 20, 2024

Fixes

Description

  • Added i18n dependencies (Babel, polib, transifex-python) to Pipfile
  • Updated i18n settings in settings.py
  • Added translation marks in templates, models, views, and tests
  • Integrated i18n URL patterns for language support
  • Added a language selection dropdown in the header
  • Ran makemessages to generate translation files (machine-translated into Spanish for testing) and compiled messages using compilemessages

Technical details

This implementation provides basic Spanish translations for testing. Full integration with Transifex for managing translations will be handled in future steps. The language selection dropdown is implemented using Django’s i18n framework, ensuring smooth language switching without the need for custom JavaScript.

Screenshots

image image image

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@rypptc rypptc requested review from a team as code owners October 20, 2024 03:42
@rypptc rypptc requested review from TimidRobot, possumbilities and krysal and removed request for a team October 20, 2024 03:42
Copy link
Member

@TimidRobot TimidRobot left a comment

Choose a reason for hiding this comment

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

This is an impressive amount of work!

In addition to the code comments, below, please:

  1. ensure this pull request (PR) branch (rypptc:features/implement-internationalization) is up-to-date with the main branch of creativecommons/legaldb and all conflicts are resolved.
  2. use the formatting / static analysis tools: https://github.com/creativecommons/legaldb#code-style
    • They can also be run in Docker so you don't have to configure pipenv:
      docker compose exec app isort .
      docker compose exec app black .
      docker compose exec app flake8 .

@@ -1,15 +1,16 @@
{% load compress %}
{% load static %}
{% load static i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

<p class="hero-description body-normal">Please add any cases related to Creative Commons licenses and other legal tools that you think should be included in the database. &nbsp;&nbsp;<span class="required">*</span> Required.</p>
<h1 class="hero-title title is-2">{% trans "Case Submission" %}</h1>
<p class="hero-description body-normal">
{% trans "Please add any cases related to Creative Commons licenses and other legal tools that you think should be included in the database." %}
Copy link
Member

Choose a reason for hiding this comment

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

Longer sentences and paragraphs should use {% blocktrans %}. For example:

      {% blocktrans trimmed %}
      Please add any cases related to Creative Commons licenses and other legal tools that you think should be included in the database.
      {% endblocktrans %}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I get it

@@ -1,11 +1,15 @@
{% extends 'legal_db/base.html' %}
{% load widget_tweaks %}
{% load widget_tweaks i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

@@ -1,23 +1,23 @@
{% extends 'legal_db/base.html' %}
{% load static %}
{% load static i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

@@ -1,20 +1,20 @@
{% extends 'legal_db/base.html' %}
{% load markdown_extras %}
{% load markdown_extras i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

<p class="hero-description body-bigger column is-9">
{% url 'case_index' as case_index_url %}
{% url 'scholarship_index' as scholarship_index_url %}
{% blocktrans with case_url=case_index_url scholarship_url=scholarship_index_url %}
Copy link
Member

Choose a reason for hiding this comment

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

please also include trimmed option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

@@ -1,14 +1,15 @@
{% load static i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

@@ -1,4 +1,4 @@
{% load static %}
{% load static i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

@@ -1,25 +1,26 @@
{% load widget_tweaks %}
{% load widget_tweaks i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

@@ -1,23 +1,23 @@
{% extends 'legal_db/base.html' %}
{% load static %}
{% load static i18n %}
Copy link
Member

Choose a reason for hiding this comment

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

please update load listing to be in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed

@rypptc
Copy link
Contributor Author

rypptc commented Oct 23, 2024

All requested changes have been made, I made style checks with isort, black and flake8 as indicated, and legaldb main branch has been merged into the features/implement-internationalization branch, and all existing conflicts were solved.

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

Successfully merging this pull request may close these issues.

2 participants