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

the "plonejsi18n" view canot create correct language code when request 's LANGUAGE contain sub-language #180

Open
adam139 opened this issue Jul 12, 2019 · 0 comments

Comments

@adam139
Copy link

adam139 commented Jul 12, 2019

the "plonejsi18n" view is responsive for getting tranalated vocabulary through ajax request.
When the browser request's LANGUAGE contain sub-language,for example:"zh-CN",i18n.i18njs will generate wrong language code: "zh-cn",This correct language code should be "zh_CN".
`
def call(self, domain=None, language=None):

    if domain is None:
        catalog = {}
    else:
        if language is None:
            language = self.request['LANGUAGE']
        catalog = self._gettext_catalog(domain, language)

    response = self.request.response
    response.setHeader('Content-Type', 'application/json; charset=utf-8')
    response.setBody(json.dumps(catalog))
    return response`
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

No branches or pull requests

1 participant