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

Add support for multi-languages #49

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add support for multi-languages #49

wants to merge 6 commits into from

Conversation

MarcMcIntosh
Copy link

Adds the suggested changes to #40 and resolves conflicts

For get_by_uid, get_by_id, get_by_ids, the default language should be * (meaning we search over all languages)

To test run python setup.py test

@MarcMcIntosh MarcMcIntosh requested a review from srenault July 23, 2020 11:21
@srenault srenault changed the title Tailsdotcom Add support for multi-languages Jul 24, 2020
if len(documents) > 0:
return documents[0]

def get_by_uid(self, type, uid, ref=None):
return self.query_first(predicates.at('my.' + type + '.uid', uid), ref)
def get_by_uid(self, type, uid, ref=None, lang='*'):

Choose a reason for hiding this comment

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

we forbid to use a wilcard for a getByUID since uids are defined per language.
https://github.com/prismicio/prismic-javascript/blob/master/src/ResolvedApi.ts#L199
you should implement the same logic there

Choose a reason for hiding this comment

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

And add a test to make sure you can't query without a lang

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

Successfully merging this pull request may close these issues.

3 participants