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

[RFC] Localized descriptions #193

Open
Naoto-Ida opened this issue Jul 13, 2016 · 3 comments
Open

[RFC] Localized descriptions #193

Naoto-Ida opened this issue Jul 13, 2016 · 3 comments
Labels
👻 Needs Champion RFC Needs a champion to progress (See CONTRIBUTING.md) 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md)

Comments

@Naoto-Ida
Copy link

We are currently thinking about using GraphQL for our public API.

We are based in Japan, so we'd like to have localized descriptions for each GraphQL object for our local developers who are interested in trying our API.
Is there current support for this, or is it something that could come in the future?
Thanks.

@leebyron leebyron added enhancement 👻 Needs Champion RFC Needs a champion to progress (See CONTRIBUTING.md) labels May 1, 2018
@leebyron leebyron changed the title Option for localized descriptions [RFC] Localized descriptions May 1, 2018
@leebyron
Copy link
Collaborator

leebyron commented May 1, 2018

I think this is a great idea. Perhaps the description introspection field should include an argument selecting language, though I'm sure there are other options as well.

This needs a champion to write the spec text and propose implementations in at least the GraphQL.js reference implementation.

@ivome
Copy link

ivome commented May 1, 2018

I added localization of descriptions to one of my GraphQL implementations by switching the locale context internally in the server depending on request headers and/or a locale that is appended to the API URL. This works with the current GraphQL spec but is very specific to this implementation. I think formalizing this is a great idea!

A few random thoughts:

I think this is a great idea. Perhaps the description introspection field should include an argument selecting language

What would that argument look like? Just a simple String? How does a client know what languages are supported by a GraphQL server? Should that be exposed via the introspection API? We could also add a new Locale Enum type with supported ISO language codes to the spec which could also be used elsewhere in the schema, but this type could potentially have several hundred values if you consider all country and language code combinations. Or a new Locale scalar type which could have validation for input values etc. The downside would be that those types might be unwanted artifacts in GraphQL Servers that don't support localization.

Schema Definition Language:
I like how we can add descriptions in the SDL right next to the type definition with the current spec. Should the localized descriptions live in the SDL documents?

@Naoto-Ida
Copy link
Author

Even though I am not part of the company where this topic was of concern, I'm still quite interested in the development of this feature.

To avoid bloating the spec, I guess the most logical thing for now is to pass the locale somehow to the resolver method and use that to render the appropriate localized description.

@leebyron leebyron added 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md) and removed enhancement labels Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👻 Needs Champion RFC Needs a champion to progress (See CONTRIBUTING.md) 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md)
Projects
None yet
Development

No branches or pull requests

3 participants