首页 > 解决方案 > 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 上是否有任何参数强制响应始终使用特定语言?

标签: google-sheetsgoogle-drive-api

解决方案


推荐阅读