Closed (fixed)
Project:
Commerce Stock
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 May 2012 at 13:01 UTC
Updated:
26 Nov 2018 at 16:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
guy_schneerson commentedgood point ranx,
i don't think you are missing something, its me that missed this one out.
I think their is an i18n module for translating rules but i haven't used it another option is for me to put the text set by rules through t().
I will look into this and try and find the best approach
Comment #2
guy_schneerson commentedok i gave the i18n module a go and it rocks (see image attached my out of stock translated to french using Google so sorry if its ...)
checkout http://drupal.org/node/1485738
not sure if this is the best approach for the module but it is the way get thing working at the moment.
Comment #3
ranx commentedCould you please elaborate how exactly you were able to translate the message.
I have the rules_i18n module enabled together with the latest dev version of entity API and ver. 1.5 of i18n. A "Translate" tab appears in the rule settings together with new "Translate" actions. But where can I translate the message? Do I need to add a new action or what? The message certainly did not appear to the "translate interface" page.
Comment #4
guy_schneerson commentedranx,
you need to add a "Translate a text" action before the "Set the state of the add to cart form" one.
Set the text to "Out of stock" and give a name to the variable.
you can then use this variable as the "The text to set the action to" of the "Set the state of the add to cart form" (switch to data selection so you can select your variable)
Comment #5
ranx commentedGot it working just fine with the instructions. Thank you very much!
Comment #7
guy_schneerson commentedI am considering a new approach to this using translatable text and tokens, will post updates when news.
Comment #8
xiukun.zhou commentedThis patch will check wether the rules_i18n enabled or not.
If enabled, an aciton "translate a text" will be added in the action list for translating the message.
if not, it use the default rules config as before.
Comment #9
guy_schneerson commentedThanks xiukun.zhou
Useful patch however I will not commit for now as I am not sure this is the best way for Stock and the existing rules can be modified to use rules_i18n.
Comment #10
guy_schneerson commentedxiukun.zhou
I didn't get time to do much with other approaches and this needs to go in, so will have another look
Comment #12
guy_schneerson commentedThanks xiukun.zhou and sorry its taken so long.
Comment #13
xiukun.zhou commentedThanks guy_schneerson push the patch.
Comment #15
off commentedДОКОЛЕ?
Why "out of stock" is not translatable after four years?
Comment #16
guy_schneerson commentedOFF: так долго, как необходимо, чтобы прочитать несколько комментариев до ;)
http://cgit.drupalcode.org/commerce_stock/commit/?id=b9e2bcb
Comment #17
drupbasic commentedHi, I read #16, checked the file. Seems that update was already there. But still, no way to translate the message that pops up to the user when trying to add a quantity of a product that exceeds the stock available. I have been able to translate everything else on my website so I am pretty sure that I have all the modules needed and the right settings. There is no translate button on the rules page. And the text 'Maximum quantity...' is not found on the translation page neither. Also I tried to apply #4 but the 'translate text action' is not there. What I am I missing? Thx!
Comment #18
guy_schneerson commentedHi I think the i18n integration in the commit only takes effect on a new install as the condition is on the crtesating of the rule so if no i18n at the point of installing the rule gets created without i18n support. although I think you can revert the rule and that should also sort it out.
Comment #19
adam1 commentedConcerning #18, reverting does not sort it out, strings are not translatable (before trying to translate, I cleared cache and invoked the message I wanted to translated by hitting the corresponding event/page). What else can I do to make the patch work without uninstalling the module?
Comment #20
guy_schneerson commented@adam1 you can try installing it on another instance (you can use simplytest.me) and exporting the rule to be imported into your site.
Comment #21
adam1 commentedThank you, @guy_schneerson. When I tried your solution and again had no success, I realised that rules_i18n wasn't enabled and the else-part of the if-statement was used.