Hi guys (m/f),

The order statuses on the order overview page for customers are not translatable, resulting in, for example, Dutch customers being informed their orders are "Pending", which means very little to them ;-)

The solution is fairly simple and involves changing one line of code.

--- uc_order/uc_order.admin.inc (revision 722)
+++ uc_order/uc_order.admin.inc (working copy)
@@ -1046,7 +1046,7 @@
     $rows[] = array(
       array('data' => format_date($order->created, 'custom', variable_get('uc_date_format_default', 'm/d/Y'))),
       array('data' => $link, 'nowrap' => 'nowrap'),
-      array('data' => check_plain($order->title)),
+      array('data' => t(check_plain($order->title))),
       array('data' => (!is_null($order->products) ? $order->products : 0), 'align' => 'center'),
       array('data' => uc_price($order->total, $context), 'align' => 'right'),
     );

Would it be possible to implement this change in a new Ubercart release for the 6.x branch?

Thank you in advance,

Matthijs de Jonge

Files: 
CommentFileSizeAuthor
#10 993360-uc_order_status-i18n.patch1.55 KBlongwave
PASSED: [[SimpleTest]]: [MySQL] 2,798 pass(es).
[ View ]
#7 order_status.png41.09 KBmortician
#7 tax.png4.73 KBmortician
#7 attribute.png15.88 KBmortician

Comments

Title:Please make order status strings translatablePlease make order status strings translatable (I've included a patch for the one line of code that needs to be changed for this)

Title:Please make order status strings translatable (I've included a patch for the one line of code that needs to be changed for this)Make order status strings translatable
Status:Active» Needs work

From http://api.drupal.org/api/drupal/includes--common.inc/function/t/6

The only case in which variables can be passed safely through t() is when code-based versions of the same strings will be passed through t() (or otherwise extracted) elsewhere.

(emphasis added)

So your use of t() is not the correct solution unless Ubercart has previously declared all the order statuses as translatable strings, e.g. t('Pending'). Can you see if that's true?

But there's still one other thing - the patch won't work at all for translation of user-defined order statuses. I do not know of a correct way to make user-defined strings translatable.

The funny thing is Ubercart does try to translate these strings during install:

  $t = get_t();
  db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('canceled', '%s', 'canceled', -20, 1);", $t('Canceled'));
  db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('in_checkout', '%s', 'in_checkout', -10, 1);", $t('In checkout'));
  db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('pending', '%s', 'post_checkout', 0, 1);", $t('Pending'));
  db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('processing', '%s', 'post_checkout', 5, 1);", $t('Processing'));
  db_query("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('completed', '%s', 'completed', 20, 1);", $t('Completed'));

However, during install a lot of translations aren't available (currently uc_order only comes with Japanese and German), so this isn't actually all that useful.

So you're right that my "patch" is not actually a very reliable solution to the problem. A better solution would be to store an identifier for the order status alongside the order instead of a description and then to attempt to display a localized string associated with that identifier. Implementing that would be quite a bit of work, however.

My "patch", even though it's not, strictly speaking, correct, and not 100% reliable, does cause the desired output to be generated in most cases. Would it be possible to implement it until the order statuses are localized "properly"?

As a reference,
if you are using a single language which is different than English, you can edit the strings here:
admin/store/settings/orders/edit/workflow
(this doesn't apply to translating user defined strings)

Version:6.x-2.4» 7.x-3.x-dev

This should be addressed in 7.x-3.x first.

StatusFileSize
new15.88 KB
new4.73 KB
new41.09 KB

Yes, It's important. In Ubercart 7.x-3.1 uc_attribute, uc_taxes, order status...can’t be translated to another langauge. Please correct it ASAP.

@mortician: Yes,obviously, we're aware of the issue - that's why this thread is here. Do you have a suggestion for how to fix this problem which affects many different aspects of Drupal, or are you just complaining? Perhaps you could hire someone to come up with a solution, then donate that solution back so everyone could benefit?

any progress?

Status:Needs work» Needs review
StatusFileSize
new1.55 KB
PASSED: [[SimpleTest]]: [MySQL] 2,798 pass(es).
[ View ]

Please test the attached patch. You need i18n_string module enabled. After applying the patch and flushing cache, go to /admin/config/regional/translate/i18n_string and refresh "Ubercart order status", you should then be able to translate order statuses on the Translate tab.

Status:Needs review» Reviewed & tested by the community

Patch #10 works !

Just a strange thing: the default language of my site is italian and the status titles were in italian before the patch application; after the patch, I navigate to /it/admin/config/regional/translate/translate, and correctly see the old italian titles; the innovation is that I can translate the strings into english by clicking the edit links (and they are seen translated from /en pages). What's strange is that the "languages" column shows them all as "it".
I'd think they should be marked as "en" or "en" depending on the fact I translated or not. Or, even better, the en/admin/config/regional/translate/translate and it/admin/config/regional/translate/translate pages should always show the titles in english and mark them as "it" or "it" per translation state.

Status:Reviewed & tested by the community» Fixed

Committed #10.

I am not sure why that happened, if you imported the Ubercart translation file then perhaps the order status strings were picked up from there in Italian and so they were recognised as already being in that language. We also add statuses in translated form on install where possible, perhaps this should be removed now we can translate statuses properly.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hello there,
Can anyone suggest how this can be fixed for d6 / u2 ?
thx