google-sheets - Google API 强制英语响应消息
问题描述
我正在使用 Google Sheets API 在用户进行身份验证后对用户的电子表格执行操作,其中一些操作会引发错误,例如:
This action would increase the number of cells in the workbook above the limit of 5000000 cells
或者
You are trying to edit a protected cell or object. Please contact the spreadsheet owner to remove protection if you need to edit
在这两种情况下,API 都会返回 `HttpError 400 代码,而字符串值是区分彼此并了解具体问题的唯一方法。未提供与该问题相关的错误代码。问题是字符串根据用户帐户语言设置以不同的语言出现,因此很难映射所有语言可能性。例如,下面的消息与上面的消息相同,但用的是西班牙语:
Estás intentando modificar una celda o un objeto protegido. Si necesitas realizar cambios, comunícate con el propietario de la hoja de cálculo para que quite la protección
API 上是否有任何参数强制响应始终使用特定语言?
解决方案
推荐阅读
- database-design - 适合电子商务的数据库架构
- django - 如何获取表单中的特定字段?
- regex - 如何删除括号内的文字和括号?
- mediawiki-api - MediaWiki:“attachedlocal”和“centralids”是什么意思?
- r - 带有 5 个参数的 Rcpp lapply() 或 mapply()
- angular - 如何在Angular(Jasmine)中为if else语句编写测试用例
- ios - 当我通过在 Swift 中分配策略将 CGFloat 值设置为 AssociatedObject 时为什么会崩溃?
- r - 仅包含在 R 中第 1 和第 3 个四分位数之间的数据的平均值
- python - 使用 groupby pandas 更改唯一计数
- go - 使用 go get 和自定义端口