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

Handle multi language input fields in web ui #141

Merged
merged 31 commits into from
Apr 5, 2023

Conversation

eighttrigrams
Copy link
Contributor

No description provided.

(projectDocument.resource.shortDescription
&& projectDocument.resource.shortDescription.length <= MAX_LABEL_LENGTH
? projectDocument.resource.shortDescription
const shortDescription = getTranslation(projectDocument.resource.shortDescription);
Copy link
Contributor Author

@eighttrigrams eighttrigrams Mar 29, 2023

Choose a reason for hiding this comment

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

resource.shortDescription kann leer sein.
wir müssten nochmal schauen: in getTranslation() sollte es eigentlich '' zurückgeben. kommt der code hier damit klar oder braucht er undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ich lasse getTranslation jetzt immer '' zurückgeben (siehe unten in languages.ts)

</div>;
const renderTitle = (title: string, projectDocument: Document) => {

const titleStr = getTranslation(title as undefined as I18N.String);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix typing. param title should be of type I18N.String.
auch nochmal gucken, wenn ich den rückgabewert vom getTranslation anpasse (siehe unten, '' vs undefined)

@@ -31,7 +32,7 @@ function initializeLanguages(): string[] {
window.navigator.languages
.map(getBasicLanguageCode)
.filter(language => language.length === 2)
.concat(USER_INTERFACE_LANGUAGES)
.concat(USER_INTERFACE_LANGUAGES.concat(['unspecifiedLanguage']))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unspecifiedLanguage wird jetzt hier hinzugefügt

@@ -41,3 +42,14 @@ function getBasicLanguageCode(language: string): string {
const index: number = language.indexOf('-');
return index > 0 ? language.substring(0, index) : language;
}


export function getTranslation(labels: I18N.String|undefined): string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Diese Funktion hat sich jetzt vereinfacht, dadruch dass wir 'unspecifiedLanguage' zu LANGUAGES hinzugefügt haben. Jetzt bleibt nur noch ein dünner Wrapper um die originale I18N.getTranslation Funktion herum. Wenn Field Desktop jetzt auch so läuft, würde ich es einfach dabei belassen und core nicht anfassen. Oder wäre das gut, die 'unspecifiedLanguage' Behandlung dort hinzufügen?

Copy link
Member

Choose a reason for hiding this comment

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

Wenn es läuft, lassen wir es am besten erstmal einfach so.

@eighttrigrams eighttrigrams requested a review from tkleinke April 1, 2023 13:24
@@ -0,0 +1,13 @@
defmodule Api.Worker.Enricher.Utils do

# TODO extract
Copy link
Member

Choose a reason for hiding this comment

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

Das TODO kann raus, oder?

@tkleinke tkleinke merged commit 12a2fff into master Apr 5, 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.

2 participants