-
Notifications
You must be signed in to change notification settings - Fork 82
Adding user-written translation capability to how-tos #943
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
base: main
Are you sure you want to change the base?
Adding user-written translation capability to how-tos #943
Conversation
|
@melissachen2000 It will chose the primary language if available, and if not, it will choose the first translation. |
|
Thanks, Amy! I merged in the feature and tested the changes. Found and fixed a defect in my implementation from that! I will also use that logic to figure out what the title should be in the announcer (the last checklist item). |
amyjko
left a comment
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.
Re: language codes and regions, we use the BCP-47 standard, which is 2-3 language characters, and 2-3 region characters. See more here: https://developer.mozilla.org/en-US/docs/Glossary/BCP_47_language_tag.
Re: to get a particular locale, you'll need to use the LocalesDatabase. It has an async function loadLocale, which loads the locale if necessary, and returns a LocaleText if it exists. It may not, in which case there would be no defined placeholder for that locale.
…ermissions-notifications Adding gallery access check for moderation notifications
…title not rendering
|
Thank you, Amy! Re language codes: it turns out that specifying the language code format using the number of characters doesn't work anyway (specifically for the Tamil language case, which is I also changed the schema key |
|
Great! I will likely review next Saturday in my next Wordplay session, possibly earlier if I have teaching prep time. |
Context
Currently, user-written how-tos can only be written and viewed in one language. This poses a problem if a user wants to write versions of a how-to in multiple languages. This PR sets up the user interface so that users can write how-tos in multiple languages.
The implementation uses markup strings to store translations. Each how-to is stored as a markup Doc with a locale tag. For how-tos made prior to this PR, the how-to text is just stored as a regular string. Since I accidentally hardcoded the locales on these how-tos to be
en-US, I included some logic that detects if a string is not a markup string, and attaches theen-USlocale to it.Related issues
Verification
¶hello¶/en-US¶hola¶/es-MX).To test that previously-written how-tos can still be read:
Checklist
MarkupHTMLViewdoesn't handle translations. Based on our conversation in Slack, it sounds like this is not implemented yet?l.ui.howto.editor.titlePlaceholder. We use this placeholder value if the title is left empty (here is the implementation). I think having a placeholder title is probably still useful, but I don't know how to access the placeholder title for a particular locale. What I would like to be able to do is: