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

O3-1325: Ability to have arbitrary translations for labels in AMPATH forms. #19

Merged
merged 5 commits into from
Nov 23, 2022

Conversation

hadijahkyampeire
Copy link
Contributor

@hadijahkyampeire hadijahkyampeire commented Nov 18, 2022

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.

Summary

  • Add support for i18n translation in our forms
  • Apply translation support on form labels and placeholder
  • Add some mock translations

Screenshots

Spanish

Screenshot 2022-11-20 at 16 20 31

Kmer

Screenshot 2022-11-20 at 16 20 09

French

Screenshot 2022-11-20 at 16 19 38

Failure

  • For some reason, the labels are not getting translated, it could be because of the nesting that is involved to get labels @ibacher @FlorianRappl please advise on how to apply translations to labels like Visit date , Provider etc

Issue

Ability to have arbitrary translations for labels in AMPATH forms

Other

Copy link
Contributor

@FlorianRappl FlorianRappl left a comment

Choose a reason for hiding this comment

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

I think a great change - only thing I do not yet understand is how the translations are loaded as the HTTP loader is not configured.

src/app/app.module.ts Outdated Show resolved Hide resolved
@hadijahkyampeire
Copy link
Contributor Author

BTW @FlorianRappl this PR is not complete, it still has a hard-coded implementation that I need to remove, but I am not sure how to do that yet, do you have some pointers?

>
</ofe-number-input>

<input
<ofe-number-input
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a mistake no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that is the correct one because it was throwing an error as input just so I used the same implementation we did on the form ofe-form and did the same for input and it stopped showing the error.

Copy link
Member

Choose a reason for hiding this comment

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

So, ofe-number-input is a custom tag for the custom element defined here. I think this exists largely so we can match the carbon styling for numeric inputs. So we sue it above when a numeric input is being rendered (note the *ngSwitchCase="'number'"). This component, however, is a simple text input which shouldn't need additional styling and was just using the standard HTML input tag. If there were errors, we should figure why those errors occurred and fix them, because the numeric input styling is likely to look wrong for text inputs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will look into that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ibacher this is the error when it is just input
Screenshot 2022-11-21 at 22 48 30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

theme seems to be causing the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have seen this in the main branch and I have seen another solution you mention for adding carbon design class, it is confusing when we should use ofe-number-input and when we need to use just input.

Copy link
Member

@ibacher ibacher Nov 21, 2022

Choose a reason for hiding this comment

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

The guiding rule here is that this section of the form-renderer.component.html is, in essence, a big switch statement that determines the tag based on the question, so in this context, each tag should only appear once.

In your screenshot, but not in the PR, I see you're missing the ofeTextInput that was there originally which is why you're seeing the error. ofeTextInput is the directive that adds the necessary styling to this element, including the theme attribute. If you just add that back in, the error should go away.

src/app/app.module.ts Outdated Show resolved Hide resolved
@hadijahkyampeire
Copy link
Contributor Author

@ibacher I have added some screenshots.

@ibacher ibacher merged commit 64261ab into main Nov 23, 2022
@ibacher ibacher deleted the hadijah/03-1325-i18n branch November 23, 2022 14:43
@vasharma05 vasharma05 changed the title 03-1325: Ability to have arbitrary translations for labels in AMPATH forms. O3-1325: Ability to have arbitrary translations for labels in AMPATH forms. Dec 19, 2023
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.

4 participants