This is a patch to add the ability to have Japanese numerical values usable for quantity input areas.

While this just covers Japan, the problem is that if someone using Japanese input, inputs a numerical value, the byte value of this numerical value does not match up. This could be expanded to more language and input formats outside of Japan.

Meaning that 1 and 1 are not the same thing.

This patch will search for this and replace 1 with 1 so that Japanese users don't need to worry about input of their text and what format they input in.

We will update this patch in the future to cover the admin, and do one for address input fields too, but for now this just deals with adding to cart features and adjusting quantity in the cart.

Regards,

Shaun
Alethia
www.alethiadesign.com

CommentFileSizeAuthor
ubercart_numbers.patch2.16 KBDokuro

Comments

Bilmar’s picture

Dokuro - thanks for the great work. I will be testing this patch over the weekend.

tr’s picture

Isn't this an issue that affects all of Drupal? I don't know how Japanese numerical input is normally handled in Drupal, but if the problem is not something caused by Ubercart I think it should be addressed in Drupal not in Ubercart. There are many places all over Drupal that accept numerical input - don't they all fail with Japanese numerical input?

Even if this is not the case, I think a better way to address the issue would be to create a new type of form element (i.e. implement hook_elements()) to be used instead of textfield for when numerical text is entered. That way it can be reused everywhere in Drupal or Ubercart, rather than having to add a form_validate to each and every form that wants to accept numerical text.

Dokuro’s picture

I think we need to think about the input forms of Ubercart and what Ubecart is doing. Ubercart is checking to see if 2 or 2 is a quantity. All of Drupal is not checking for quantities, so it would not apply to all of Drupal.

longwave’s picture

Category: bug » feature
Status: Needs review » Postponed

I don't consider this a bug, nobody else has requested this change, and I can't find anything else about Japanese number input in Drupal or even other PHP apps. Is this really an issue?

longwave’s picture

Status: Postponed » Closed (won't fix)

If this is still needed, feel free to reopen with more info and/or a patch to implement it.

Dokuro’s picture

Yeah, its still an issue, and to follow up on your other post. Yes, this is never really addressed outside of Japan, but still a major issue. I did include this when I was working on the Zen-Cart language pack. We use it internal for our clients. So it is good for anyone inside Japan.

I guess the best thing is leave it up to you, but at least the patch is here for anyone that wants to use this that runs into this issue as it is an issue with Japanese and people who deal with Japan.

Thanks!

Shaun