-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
(projectDocument.resource.shortDescription | ||
&& projectDocument.resource.shortDescription.length <= MAX_LABEL_LENGTH | ||
? projectDocument.resource.shortDescription | ||
const shortDescription = getTranslation(projectDocument.resource.shortDescription); |
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.
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
?
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.
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); |
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.
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)
web/ui/src/shared/languages.ts
Outdated
@@ -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'])) |
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.
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 { |
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.
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?
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.
Wenn es läuft, lassen wir es am besten erstmal einfach so.
remove todo
…thub.com/dainst/idai-field into handle-multi-language-input-fields-in-ui
@@ -0,0 +1,13 @@ | |||
defmodule Api.Worker.Enricher.Utils do | |||
|
|||
# TODO extract |
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.
Das TODO kann raus, oder?
No description provided.