Needs work
Project:
Commerce Shipping
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Dec 2011 at 16:16 UTC
Updated:
28 Feb 2018 at 10:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jimkont commentedForgot to attach the patch :)
Comment #2
rszrama commentedAhh, didn't realize you posted the same thing in the Shipping Flat Rate queue. Let's close that one as a duplicate and try to find a solution here. For reference, this was my comment there:
We're always open to solutions that don't abuse the API. I know there are modules out there for handling this sort of thing, but I don't have any experience with them. If you research them and recommend a solution, that will go a long way toward resolving the issue for everyone. : )
My hunch is there's some i18n module we can integrate with to solve this, but I don't have any experience with it.
Comment #3
googletorp commentedRunning t function on a variable is a no go.
One solution could be to use variable_get/set since you can translate those.
Comment #4
rszrama commentedI wonder if http://drupal.org/project/variable might offer a solution, too. : ?
Comment #5
atlea commentedStoring it in a variable and using the variable module for translations is a viable solution.
I prefer using http://drupal.org/project/stringoverrides for its simplicity. All it does is add an UI for the $custom_strings variable that is used by t() (and has locale support). We can mimic what t() does and reuse this variable..
I don't have 1.x installed and headed for bed, so I'll just try to wing this one.. it would be something like:
This would also work for sites without the locale module enabled... or even in settings.php. ;)
waddayathink? :)
Atle
Comment #6
googletorp commentedWaiting for #1422996: localization and i18n integration in a stable release of Rules.
Comment #7
googletorp commentedWe can actually solve this issue now.
Comment #8
summit commentedHi, I would love to see this committed. Where do I need to set the code in http://drupal.org/node/1369696#comment-5382990 for the shortterm solution?
And any progress on this stable solution please?
greetings, Martijn
Comment #9
luksak@googletorp: I am trying to find the place to fix this without success. Where could this be done?
Comment #10
googletorp commentedI'm guessing this needs to be handled in the rules integration code. I don't really know what's needed since I haven't done this before and never got around to look at it.
Comment #11
luksakJust fixed it in another module:
Not really clean... But hey, it works :)
Comment #12
googletorp commentedThe issue here is the label when it's configured. So the idea is that you can enter your custom label in the rules interface but have it be translatable.
Comment #13
luksakSo this was not solved by #1422996: localization and i18n integration? Is this a rules issue?
Comment #14
Gerto commentedStrange that something this basic is so hard to do.
I ended up solving it like this:
Data Comparison: Parameter: Data to compare: [site:current-page:language], Data value: *LANGUAGE*
Not sure if this is a proper way to do this, but it works and you don't have to make any code changes, so seems ok to me :)
Comment #15
shaneonabike commentedI am confused why we can't actually run the labels through a proper i18n function. The rules bug that was apparently blocking this is closed?
Comment #16
shaneonabike commentedI guess it would require defining the proper i18n info hook and each time a new shipping type was setup it would need to be added.
https://groups.drupal.org/node/152929
Comment #17
guy_schneerson commentedThanks for working on this guys
I had to get this working for a client and used the following. Its a bit of a hack but the client is happy so it will do for now.
Comment #18
guy_schneerson commentedthe problem with the above is it only solves the issue on the selection form so in places like the shopping cart view it will show none translated shipping.
The code below solves this and is a better approach (although no replacement to sorting this issue)
Comment #19
MyriamB commented#18 worked for me. Thank you.
Comment #20
chefnelone commented#18 worked for me too ;) The patch doesn't apply to the actual dev version.
Comment #21
fugazi commented#18 worked for me.
Comment #22
stella commentedYou really shouldn't be calling the t() function on a $variable, especially when the value in that variable is a user entered one such as this. See the API docs for more info: https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/t/7
Comment #23
guy_schneerson commentedHi @stella you are correct and that's why I described it as a hack. However I think that the security issue is mitigated by the fact that the user that has entered the text is an admin.
But yes +1 me for needs work :)
Comment #24
shaneonabike commentedI recently tried to apply the solution in #18 but it never gets called in a custom module which is odd
Comment #25
s.messaris commentedFor anyone needing this for drupal 8 and stumbling on this issue, the corresponding issue for d8 is https://www.drupal.org/project/commerce_shipping/issues/2934142