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

Improve translation handling in JavaScript and TypeScript #2036

Merged
merged 11 commits into from
Nov 6, 2023

Conversation

hansegucker
Copy link
Collaborator

Closes #2027

@hansegucker hansegucker changed the title Improve translation handling in JavaScript and TypeScript WIP: Improve translation handling in JavaScript and TypeScript Oct 16, 2023
@niklasmohrin
Copy link
Member

For Typescript and modules:

  1. It seems that using a global function from a module just works, so we can keep using the import as it currently is
  2. To inform Typescript about the existence of these functions, a line like the following can be added and imported in all files using it:
export declare function gettext(s: string): string;

I would suggest that these declarations live either in utils.ts or in a separate file like translation.ts, slightly preferring the latter.

@hansegucker hansegucker marked this pull request as draft October 23, 2023 16:41
@hansegucker hansegucker changed the title WIP: Improve translation handling in JavaScript and TypeScript Improve translation handling in JavaScript and TypeScript Oct 23, 2023
@hansegucker hansegucker marked this pull request as ready for review October 23, 2023 16:41
@hansegucker
Copy link
Collaborator Author

@niklasmohrin Ready for review

Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

Very cool!

evap/evaluation/templates/sortable_form_js.html Outdated Show resolved Hide resolved
evap/locale/de/LC_MESSAGES/djangojs.po Outdated Show resolved Hide resolved
evap/static/ts/src/translation.ts Show resolved Hide resolved
evap/urls.py Outdated Show resolved Hide resolved
Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

Looking good, thanks :)

evap/locale/de/LC_MESSAGES/djangojs.po Outdated Show resolved Hide resolved
evap/locale/de/LC_MESSAGES/djangojs.po Outdated Show resolved Hide resolved
evap/locale/de/LC_MESSAGES/django.po Outdated Show resolved Hide resolved
evap/static/js/.gitignore Outdated Show resolved Hide resolved
evap/static/js/locale/moment_de.js Outdated Show resolved Hide resolved
@hansegucker
Copy link
Collaborator Author

@richardebeling

Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

Thanks :)

@richardebeling richardebeling merged commit 431077a into e-valuation:main Nov 6, 2023
10 of 12 checks passed
@richardebeling
Copy link
Member

Thanks :)

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

Successfully merging this pull request may close these issues.

Translations in Javascript and Typescript
3 participants