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

Feature: i18n of issues #70

Merged
merged 4 commits into from
Jun 12, 2024
Merged

Feature: i18n of issues #70

merged 4 commits into from
Jun 12, 2024

Conversation

alessiostalla
Copy link
Member

I've added three fields to the Issue class:

  • node: to be able to refer to a node and not just a position
  • code: a standardized issue code that we can use to categorize issues, as a key for i18n, etc.
  • args: an object holding message arguments as strings, to be potentially interpolated in the translated issue message

The "message" field remains with two purposes:

  • as a more technical message (e.g. to write to the application log)
  • for issues coming from third-party components (e.g. ANTLR), to hold the third-party message

I've also added a test case showing how the feature could be used with a real-world i18n library (i18next).

@alessiostalla alessiostalla marked this pull request as ready for review June 12, 2024 14:53
Copy link
Member

@ftomassetti ftomassetti left a comment

Choose a reason for hiding this comment

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

It looks good to me.
If it was a PR for Kolasu, I would suggest I use it in the project for the client and then we merge it. Given it is a PR for Tylasu, I think instead that it would make sense to merge it, do a release, and in case I encounter any problem circle back. This is because I am not familiar enough with TS to use a locally published version of the library

Thank you for implementing it!

@@ -243,6 +243,22 @@ THE_ISSUE_ECLASS.get("eStructuralFeatures").add(ECore.EReference.create({
eType: THE_POSITION_ECLASS,
containment: true
}));
THE_ISSUE_ECLASS.get("eStructuralFeatures").add(ECore.EReference.create({
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should bump the version of the metamodel for this

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so, this is only needed because for some reason in the Ecore compatibility layer we decide that something is an issue if it has the same features as the Issue EClass. Since we're going to abandon ECore anyway, I wouldn't spend much on it.

@alessiostalla
Copy link
Member Author

It's a pain in JS/TS to use a local copy. In theory, in package.json you can put an https:// or file:/ URL instead of the usual version. However, in practice, when I tried it it would randomly use stale versions even if you had changed the source code of the library and rebuilt it. So it's a practice I tend to avoid; maybe today things work better, I don't know.

@alessiostalla alessiostalla merged commit 0692f1b into master Jun 12, 2024
2 checks passed
@alessiostalla alessiostalla deleted the feature/issue-i18n branch June 12, 2024 15:46
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