Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment | File | Size | Author |
---|---|---|---|
#10 | 993360-uc_order_status-i18n.patch | 1.55 KB | longwave |
#7 | order_status.png | 41.09 KB | mortician |
#7 | tax.png | 4.73 KB | mortician |
#7 | attribute.png | 15.88 KB | mortician |
Comments
Comment #1
rhmtts CreditAttribution: rhmtts commentedComment #2
TR CreditAttribution: TR commentedFrom http://api.drupal.org/api/drupal/includes--common.inc/function/t/6
(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.
Comment #3
rhmtts CreditAttribution: rhmtts commentedThe funny thing is Ubercart does try to translate these strings during install:
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"?
Comment #4
TR CreditAttribution: TR commentedSee also #1066364: META: Make custom data translatable.
Comment #5
sylvain_a CreditAttribution: sylvain_a commentedAs 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)
Comment #6
TR CreditAttribution: TR commentedThis should be addressed in 7.x-3.x first.
Comment #7
mortician CreditAttribution: mortician commentedYes, 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.
Comment #8
TR CreditAttribution: TR commented@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?
Comment #9
ManosP CreditAttribution: ManosP commentedany progress?
Comment #10
longwavePlease 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.
Comment #11
mandreato CreditAttribution: mandreato commentedPatch #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.Comment #12
longwaveCommitted #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.
Comment #14
fotisphello there,
Can anyone suggest how this can be fixed for d6 / u2 ?
thx