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

Multiple Language Support #55

Merged
merged 7 commits into from
Apr 27, 2024
Merged

Conversation

dgovil
Copy link
Contributor

@dgovil dgovil commented Apr 16, 2024

Description of Proposal

This proposal adds a human language local to USD so that content may be localized or provide hints for assistive technologies.

Link to Rendered Proposal

Disclaimer

This proposal isn't representative of upcoming functionality in our products. This is a future looking proposal that seemed timely to augment the proposals by others here like Autodesk.

This builds on discussion in Issue 49

Supporting Materials

An example

def Foo(
    prepend apiSchemas = ["LocaleAPI"]
    language = "en_US"
) {
    string text = "There's a snake in my boot"
    string text:fr_CA = "Il y a un serpent dans ma botte"
    string text:hi = "मेरे जूते में एक सांप है"
}

Contributing

### Description of Proposal

This proposal adds a human language local to USD so that content may be localized or provide hints for assistive technologies.

[Link to Rendered Proposal](https://github.com/dgovil/USD-proposals/blob/language/proposals/language/README.md)

### Disclaimer

This proposal isn't representative of upcoming functionality in our products. This is a future looking proposal that seemed timely to augment the proposals by others here like Autodesk.

This builds on discussion in [Issue 49](PixarAnimationStudios#49)

### Supporting Materials

An example

```
def Foo(
    prepend apiSchemas = ["LocaleAPI"]
    language = "en_US"
) {
    string text = "There's a snake in my boot"
    string text:fr_CA = "Il y a un serpent dans ma botte"
    string text:hi = "मेरे जूते में एक सांप है"
}
```
### Contributing

- [X] I agree to and accept the [Supplemental Terms](https://graphics.pixar.com/usd/release/contributing_supplemental.html).
@PierreWang
Copy link
Contributor

I understand the usage of this language id now. The proposal looks good to me. I have one suggestion for the fallback behavior. In my opinion, if an attribute doesn't specify a language, it is a fallback for any language. Its language can be inferred by the runtime or the system locale, but we also need to allow the user know that it is a fallback.

For example,
def foo {
string text = "Colours are awesome"
string text:en_us = "Colors are awesome, but the letter U is not"
string text:fr = "La couleur est géniale"
}
The first attribute is the fallback attribute, and the language may be inferred as "en_gb". If the user want to display the text in language "ar" (Arabic), it may not find a suitable attribute. In that case, it should be able to know that the first attribute is the fallback one.
So GetLanguagePurposes may return a map which contains:
(fallback, foo:text)
(en_gb, foo:text)
(en_us, foo:text:en_us)
(fr, foo:fr)

@dgovil
Copy link
Contributor Author

dgovil commented Apr 16, 2024

Ah yeah that makes sense. I'll add in the wording accordingly.

@meshula meshula added the text Supporting text primitives label Apr 16, 2024
@meshula
Copy link
Member

meshula commented Apr 16, 2024

@PierreWang I think the comment from Dhruv in the other thread ran along the lines of "we can't infer based on codepoints because of ambiguity". When you say en_gb can be inferred, I think you mean that it can be inferred from system locale. I don't think it makes sense that the default fallback is the language of the system locale. If I wrote my default text in England, and you read it in France, the text did not become French because you opened it in another country :) I propose that en with no regional suffix should be the standard fallback, if the language attribute was not specified.

Copy link
Contributor

@cookiecrook cookiecrook left a comment

Choose a reason for hiding this comment

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

Minor editorial comments. Looks good overall. Thanks!

proposals/language/README.md Outdated Show resolved Hide resolved
proposals/language/README.md Show resolved Hide resolved
proposals/language/README.md Outdated Show resolved Hide resolved
proposals/language/README.md Outdated Show resolved Hide resolved
proposals/language/README.md Outdated Show resolved Hide resolved
proposals/language/README.md Show resolved Hide resolved
proposals/language/README.md Show resolved Hide resolved
@spiffmon
Copy link
Member

spiffmon commented Apr 16, 2024

@PierreWang I think the comment from Dhruv in the other thread ran along the lines of "we can't infer based on codepoints because of ambiguity". When you say en_gb can be inferred, I think you mean that it can be inferred from system locale. I don't think it makes sense that the default fallback is the language of the system locale. If I wrote my default text in England, and you read it in France, the text did not become French because you opened it in another country :) I propose that en with no regional suffix should be the standard fallback, if the language attribute was not specified.

Just plussing that, in case @PierreWang meant infer from the text itself... if the text were instead "Lorries are awesome", it's not reasonable for a DCC to infer that's en_gb even though it is...

dgovil and others added 3 commits April 16, 2024 16:44
Co-authored-by: James Craig <cookiecrook@users.noreply.github.com>
Co-authored-by: James Craig <cookiecrook@users.noreply.github.com>
Co-authored-by: James Craig <cookiecrook@users.noreply.github.com>
Copy link
Member

@spiffmon spiffmon left a comment

Choose a reason for hiding this comment

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

THis looks great, @dgovil - just a couple requests for clarification.

proposals/language/README.md Outdated Show resolved Hide resolved
proposals/language/README.md Outdated Show resolved Hide resolved
@dgovil
Copy link
Contributor Author

dgovil commented Apr 18, 2024

Thanks for the feedback, @cookiecrook and @spiffmon . I've made the changes accordingly

Copy link
Member

@meshula meshula left a comment

Choose a reason for hiding this comment

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

ready to move to draft

@meshula meshula merged commit 325b2ce into PixarAnimationStudios:main Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
text Supporting text primitives
Projects
Status: Draft
Development

Successfully merging this pull request may close these issues.

None yet

5 participants