可以在Stripe中使用非英语文本吗? [英] Non-English texts in Stripe possible?

查看:114
本文介绍了可以在Stripe中使用非英语文本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

成功将Stripe集成到我的网上商店中,我完全无法获得有关是否/如何配置Stripe以德语(而不是英语)返回错误消息的信息.

Successfully integrating Stripe into my online shop, I completely failed to get information on whether/how to configure Stripe to return error messages in German instead of English.

所以我的问题是:

使用客户端API"https://js.stripe.com/v2"时是否有本地化错误消息的方法?

Is there a way to have localized error messages when using the client-side API "https://js.stripe.com/v2"?

更新2014-05-03

我曾在Twitter和他们的一名员工上问过同样的问题(我想)告诉我这是当前 并在其TODO列表上.

I've asked the same question on Twitter and one of their staff (I guess) told me that this is currently not possible and on their TODO list.

推荐答案

进一步参考:

虽然您不能在条带错误上使用人工消息来直接在本地化页面上显示,但可以利用response.error.code提供自己的翻译.

While you can't use human messages on stripe errors to be displayed directly on localized pages, you can take advantage of response.error.code to provide your own translations.

var errorMessages = {
  incorrect_number: "The card number is incorrect.",
  invalid_number: "The card number is not a valid credit card number.",
  invalid_expiry_month: "The card's expiration month is invalid.",
  invalid_expiry_year: "The card's expiration year is invalid.",
  invalid_cvc: "The card's security code is invalid.",
  expired_card: "The card has expired.",
  incorrect_cvc: "The card's security code is incorrect.",
  incorrect_zip: "The card's zip code failed validation.",
  card_declined: "The card was declined.",
  missing: "There is no card on a customer that is being charged.",
  processing_error: "An error occurred while processing the card.",
  rate_limit:  "An error occurred due to requests hitting the API too quickly. Please let us know if you're consistently running into this error."
};


function stripeHandler( status, response ){
  if ( response.error && response.error.type == 'card_error' ){
    $( '.errors' ).text( errorMessages[ response.error.code ] );
  }

  else {
    // do other stuff (and handle api/request errors)
  }
}

代码列表在此处记录(当前在代码"部分的右列).

The list of codes is documented here (currently, right column, in the "codes" section).

这篇关于可以在Stripe中使用非英语文本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆