Currently google one tap prompt is rendered only in english. Is there a way we can pass locale to the javascript api so that prompt gets rendered in that specific language?
Asked
Active
Viewed 200 times
1 Answers
0
sorry for a very late response, however I've encountered the same problem lately.
Official documentation doesn't provide direct way to handle prompt localization. The closest think I've found is: link. With that in mind I've loaded Google client with:
<script src="https://accounts.google.com/gsi/client?hl=iso-639-code" async defer></script>
where iso-639-code is desired language, for example en, zh, de, etc.
Then I've a listener for prompt status, if status is valid (notification is displayed) iframe's source is changed simirarly to script above
// initizalization
google.accounts.id.initialize({
client_id: clientId,
callback: handleCredentialResponse,
});
// prompt initalization and callback function
google.accounts.id.prompt((notification) => {
if (notification.isNotDisplayed()) return;
const googlePromptFrame = document.querySelector("#credential_picker_container iframe");
if (googlePromptFrame) googlePromptFrame.src = googlePromptFrame.src + "iso-639-code";
});
This works fine for my purposes.

MaciejP
- 1
- 1
- 1