-
Notifications
You must be signed in to change notification settings - Fork 32
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
Adding i18n to records #593
Conversation
Affected libs:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice start !
We have to be careful about what fields are multilingual and what are not.
Also, it depends on the versions of GN... for instance, organizations
& contacts
have been converted to multilingual very shortly.
It might miss the contacts
for the last version of GN 4.2.5
.
Also, the hard work, which could be led in another PR, is about the way we run the search.
The index is multilingual, there is a setting to set the language of the catalog (which is more the language of the records of the catalog though). If set to fre
the search is led on any.fre
instead of any.default
(resourceTitleObject.fre
and all other multilingual fields). You can also have any.*
etc...
We might need to work with Christophe on this cause he studied that for geocat and see how it's handle in geonetwork vanilla as well. It's not an easy task.
🙌
) {} | ||
|
||
private readonly lang3 = LANG_2_TO_3_MAPPER[this.translateService.currentLang] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a fixed variable ? With the language switcher, I expect people to dynamically change the language of the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what's the actual behavior when we change locale.Is it reloading the page ? in this case it should work.
If it doesn't reload, I'll get a bigger look on onLangChange to edit this variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is static for now, changing the shown language dynamically would be a more involved change which is I think outside of the scope of this PR
@@ -1269,6 +1269,8 @@ export const ES_FIXTURE_FULL_RESPONSE = deepFreeze({ | |||
{ | |||
default: 'Restriction lié à l’exercice du droit moral', | |||
langfre: 'Restriction lié à l’exercice du droit moral', | |||
langger: | |||
'Einschränkung im Zusammenhang mit der Ausübung moralischer Rechte', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test 😄
1689179
to
7bce7d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!!
): T | null => selectField(source, 'default') | ||
source: SourceWithUnknownProps, | ||
lang3: string | ||
): T | null => selectField(source, lang3) || selectField(source, 'default') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
): T | null => selectField(source, lang3) || selectField(source, 'default') | |
): T | null => selectFallback(selectField(source, lang3), selectField(source, 'default')) |
Thanks for your reviews ! |
1 similar comment
Thanks for your reviews ! |
7bce7d0
to
7633dc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR is intended to get user current locale in records instead of the default one.
If a translation is available in the record for his language, it uses this one.
Issue #556