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

allow roots-contentful to be configured to pull localized entry #35

Open
rmfarrell opened this issue Oct 23, 2015 · 9 comments · May be fixed by #39
Open

allow roots-contentful to be configured to pull localized entry #35

rmfarrell opened this issue Oct 23, 2015 · 9 comments · May be fixed by #39
Labels
Milestone

Comments

@rmfarrell
Copy link

hack:

request = http_sync.request({
        method: 'GET',
        protocol: 'https',
        host: 'cdn.contentful.com',
        path: "/spaces/#{contentful_config.space_id}/entries/#{entry_id}?access_token=#{contentful_config.access_token}&locale=#{locale}"
      })

unsure what the config interface would look like...

@rmfarrell
Copy link
Author

https://github.com/carrot/roots-contentful/blob/master/lib/index.coffee#L98 is where we need to pass in the locale obj per the documentation right here: https://github.com/contentful/contentful.js#search-examples (get localized content)

@hhsnopek
Copy link
Contributor

@rmfarrell what are you thinking the outputted filename out be? view-br or br-view or would this be folder based?

@kylemac
Copy link
Contributor

kylemac commented Oct 26, 2015

the filename would be whatever is defined in the path configuration, like the current extension configuration. i'm just imagining that you can also set a locale key to get it's language's response

@rmfarrell
Copy link
Author

An entry can have multiple languages per field, the idea is to get an entry's fields in languages other than the default from any given file.

@hhsnopek
Copy link
Contributor

oh I was thinking that it would compile all the locales request, but you're thinking it'll compile just one?

@hhsnopek
Copy link
Contributor

Use Case:

  • you provide locale(s) for each entry or locale(s) for all entries
  • contentful returns with content in each locale + default local
  • roots renders all content per locale based on multi-compile

Interface:

contentful = require 'roots-contentful'

module.exports =
  ignores: ["**/_*", "**/.DS_Store"]
  extensions: [
    contentful(
      access_token: 'YOUR_ACCESS_TOKEN'
      space_id: 'aqzq2qya2jm4'
      locale: 'en-ES' # or ['lang-1', 'lang-2'] Global scope, all entries
      content_types: [
        {
          id: '6BYT1gNiIEyIw8Og8aQAO6'
          locale: 'en-ES' # Entry scope, overrides global scope
        }
        {
          id: '7CDlVsacqQc88cmIEGYWMa'
          locale: 'en-ES'
        }
      ]
    )
  ]

@kylemac
Copy link
Contributor

kylemac commented Oct 28, 2015

outstanding ☝️

@hhsnopek
Copy link
Contributor

Also going to add a way to map a locale to a prefix for each template path so that you may use different templates depending on the locale, unsure the key name atm but the object looks like this:

{
  "en-ES": "english-",
  "en-ca": "french-",
  "locale-name": "foobar-"
}

@hhsnopek hhsnopek linked a pull request Oct 28, 2015 that will close this issue
4 tasks
@kylemac kylemac added this to the v0.0.10 milestone Dec 9, 2015
@kylemac kylemac added the v.0.10 label Dec 9, 2015
@AdamPflug
Copy link

What's the status of this? Is this project just dead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants