Support » Plugin: Affiliates Manager » Strings with sprintf don’t get translated

  • Resolved wilmerlm11

    (@wilmerlm11)


    Hi there!

    Strings with sprintf don’t get translated
    Ex:
    $description = sprintf(__(‘Credit for sale of %s %s (PURCHASE LOG ID = %s)’, ‘affiliates-manager’), $amount, $currency, $txn_id);

    Others, without arguments, are looking fine though.

    Do you know why?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter wilmerlm11

    (@wilmerlm11)

    I’ve just figured out why…

    These formatted strings go (supposedly) translated to the database.
    So if I add/change the translation afterwards, the previous records are not affected at all. OUCH!!

    I don’t think this is the best approach though.
    The plugin should only store the raw data in the DB and then get the translated output when displaying it to the user. Even better if we can override how the plugin formats it so we can have our custom display for that particular string.

    Does it make sense?

    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, just to make sure we are on the same page.

    Strings with sprintf don’t get translated

    Which language are you referring too?

    Thank you

    Thread Starter wilmerlm11

    (@wilmerlm11)

    Hi @mbrsolution !
    Thanks for the response. It’s PT-BR, but I think the issue is regardless of that.

    Now that I figured out the root cause, I think the best title of this post would be:
    “Description texts get stored in the Transactions database already translated”

    So 2 problems I see on the transactions table mgmt:

    1: Description field: when the plugin will store a new record, it generates a translated description, meaning if I don’t have a translation yet or if I decided to change it later, it won’t update the already stored information.
    I think the best approach would be storing only the data and turn that in a full translated sentence only when displaying it to the user. (Allowing this formatting to be overridden as well)

    2: Type and Status fields: the plugin stores this information as strings and builds the logic over this strings, so I cannot translate that.
    Maybe the plugin could a enum ID or key to store in the database and translate the corresponding values when displaying that to the user.

    Let me know if that makes sense.
    Regards

    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, I have submitted a message to the developers to investigate further your issue/request.

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Strings with sprintf don’t get translated’ is closed to new replies.