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

OHRI-1841 Include new OHRI instance for default locale, Mock forms #123

Closed
wants to merge 4 commits into from

Conversation

larslemos
Copy link
Contributor

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

A translation new instance to refer the OHRI Forms and detect cliet browser default language, and translate Form labels to default language.

Screenshots

Related Issue

Other

const { t, i18n } = useTranslation('ohri', { i18n: i18next });
const valueTranslated = t('value', value);

//TODO: Missing button for component change language instead of default language
Copy link

Choose a reason for hiding this comment

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

My understanding is that the form-engine should not introduce any button but use what is defined by the app, I believe we have a language switcher button somewhere in O3.

Copy link

Choose a reason for hiding this comment

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

And even if we decided to add a button it would not be at the label level but rather at the form level

@@ -0,0 +1,53 @@
import htsPT from './hts_pre_test_DRAFT.PT.json';
Copy link

Choose a reason for hiding this comment

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

I believe you had these HTS forms for testing purposes when you were developing but I don't think they should be added to the repo. Please remove

Copy link

Choose a reason for hiding this comment

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

Please remove this file


type LabelProps = {
value: string;
tooltipText?: string;
};

export const OHRILabel: React.FC<LabelProps> = ({ value, tooltipText }) => {
const { t, i18n } = useTranslation('ohri', { i18n: i18next });
Copy link
Member

Choose a reason for hiding this comment

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

Am not sure if the key ohri was meant to imply something specific but i believe we should opt for more generic names and not organization specific naming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an existing i18n instance, I was not able to override to reference the forms.
So, within it does not lookUp forms resources that has subforms with locale.
We can see together how to override that.

@@ -0,0 +1,133 @@
{
"name": "HTS Pre-Test Counselling",
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if i missed a reference to these json files but these should be removed if not needed along other unused json files

Comment on lines 2 to 7
"finalSchema": "Schéma Final",
"formIntent": "Intention du Formulaire",
"formRender": "Rendu du Formulaire",
"formRenderMenuLink": "Rendu du Formulaire",
"formRenderTestTitle": "Test de Rendu du Formulaire",
"generatedForm": "Formulaire Généré",
Copy link
Member

Choose a reason for hiding this comment

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

Some of these keys are are not essential to the form engine but rather other esms, in this case Form Render we so some clean up of this

Comment on lines +12 to +15
const resources = {
pt: { ohri: ptTranslation },
fr: { ohri: frTranslation },
en: { ohri: enTranslation },
Copy link
Member

Choose a reason for hiding this comment

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

This key will have to be changed based off the previous comment about organization specific naming

@pirupius
Copy link
Member

pirupius commented Nov 3, 2023

Closing as this has become stale and needs to be reworked

@pirupius pirupius closed this Nov 3, 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.

3 participants