prime
prime copied to clipboard
Localized Field
Do you think it would be possible in the future to have localized fields instead of localized documents?
Well, I doubt we will replace it completely, but we may implement them somehow. Contentful does this very well, so I may end up model it after them
I am probably going to include this in 0.3.0 in the form argument on each field.
query {
Blog {
title
titleNL: title(locale:"nl")
body(locale:"is")
}
}
Would this work for you? To reduce bloat this could be configurable by schema or field.
I understand why it must be done this way, but it’s not pretty.
Personally, I would rather have the option to filter all the fields from a query parameter.
query(locale: “es”) {...
I think querying the same field in multiple languages in the same query is not a common case, though still useful for advanced cases and composing.
On Tue, 5 Feb 2019 at 07:30, Birkir Gudjonsson [email protected] wrote:
I am probably going to include this in 0.3.0 in the form argument on each field.
query { Blog { title titleNL: title(locale:"nl") body(locale:"is") } }
Would this work for you? To reduce bloat this could be configurable by schema or field.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/birkir/prime/issues/43#issuecomment-460528407, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcgaebulN4iz79Iq2CRu4Ya47-CL7s1ks5vKST7gaJpZM4aH7cP .
I don't have a strong opinion on how Localization is implemented, but I'm glad to see it will be released on 0.3.0 or soon enough
Keep up the great work, thanks for open sourcing! 👍 💯
The way Cockpit CMS does it is with a URL query parameter. If the parameter is not provided the localized fields get a locale suffix. So far this is the setup that has worked best for me.
Ok. But how is that different from what we already have?
query {
Blog(locale:"nl") {
title
body
}
}
I am starting to think that this ticket is more about UI rather than API, am I correct?
That would indeed work, of course. I brought up the other approach just in case it might give you more ideas.
My concern is more towards multilingual sites using gatsbyjs.
GraphCMS is also doing this on field level:
query page($id: ID, $locale: Locale) {
page(where: { id: $id }) {
updatedAt
createdAt
id
title
slug(locale: $locale)
}
}
@birkir do you still plan to implement this in 0.3?
My only question with translated documents - how do you connect two documents?
For example, we have city tour website. We have a list of cities and a list of places for each city). So titles/descriptions suppose to be translated, but geo-location, open/closing times, price range are all the same across the languages. What I do now is that I have same entities in DB, but translate fields.