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

Support the US and Chinese region #33

Open
yamaryu0508 opened this issue Jan 31, 2018 · 4 comments
Open

Support the US and Chinese region #33

yamaryu0508 opened this issue Jan 31, 2018 · 4 comments

Comments

@yamaryu0508
Copy link

yamaryu0508 commented Jan 31, 2018

Now just Japanese region is available. Could you please support the US and Chinese region like go-kintone or cli-kintone ?

Here is my idea.

# account.py
class Account(object):
    def __init__(self, domain,
                 login_id="", login_password="",
                 basic_id="", basic_password=""):
        self.login_id = login_id
        self.login_password = login_password
        self.basic_id = basic_id
        self.basic_password = basic_password
        if '.' in self.domain:
          self.domain = domain
        else:
          self.domain = "{0}.cybozu.com".format(domain)

    def to_header(self, api_token="", with_content_type=True):
        header = {}
        header["Host"] = "{0}:443".format(self.domain)


# application.py
class Application(BaseAPI):
    API_ROOT = "https://{0}/k/v1/{1}"

# any other...

Thanks.

@icoxfog417
Copy link
Owner

icoxfog417 commented Feb 1, 2018

Thank you for the reporting issue. I don't know cybozu.com is only Japan!

There is an issue related to the region (language setting?) (#27). So I think to get the region information (ja, cn, en?) as an argument will be suitable for Account.

  • Pros: If we can use region information, we can handle some differences related to the region.
  • Cons: If kintone add the new region, we have to add new if statement at the time. The process is a little boring.

What do you think about this?

@will-yama
Copy link

I will share what I know about the language settings in kintone.

The language settings of the API is the same as the language settings of the user who authenticated the API.
By default, on all regions, all user's Language settings are set to "Use Web Browser settings".
If you were to call an API using that user from a server, the server will not know what language to call the API in. In this case, it looks at the domain's "Localization" language settings (the system locale). This is information is saved within the Administrator settings. The API will call the API in that language automatically.

Different regions have different "Localization" language settings set on them, by default:
cybozu.com (JP region) -> English
kintone.com (US region) -> Japanese
cybozu.cn (CN region) -> Simplified Chinese

[Case 1.]
US region user has their language settings set as "Use Web Browser settings"
-> API from server will be called in English

[Case 2.]
US region user has their language settings set as "Japanese"
-> API from server will be called in Japanese

[Case 3.]
JP region user has their language settings set as "Use Web Browser settings"
-> API from server will be called in Japanese

[Case 4.]
CN region user has their language settings set as "English"
-> API from server will be called in English

There are many things to consider when calling APIs and handling languages.
I have summed up some examples in kintone here
https://qiita.com/will-yama/items/662de9d8cb8f42343ef1

I think yamaryu0508's suggestion is a good place to start off.
If won't cover every issue, but I think we can fix other issues as we go on.

@icoxfog417
Copy link
Owner

@will-yama Thank you for letting me know. It seems to be difficult to determine the language setting explicitly. So I'll implement the simple @yamaryu0508 solution.

@will-yama
Copy link

@icoxfog417
Thank you!
I will plan to play around with the SDK on a US region environment :)

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

3 participants