Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-7310

Fix interpolation in externalized strings

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.0.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide

      Strings that have been externalized in Puppet do not contain interpolation

      Show
      Strings that have been externalized in Puppet do not contain interpolation
    • Team:
      Agent
    • Story Points:
      5
    • Sprint:
      AP 2017-03-08, Agent 2017-03-22
    • Release Notes:
      Not Needed
    • QA Risk Assessment:
      No Action

      Description

      Ruby fills in interpolated values in strings before passing those strings to gettext to use as translation keys. Therefore we cannot use `#{}` interpolation in externalized strings, but must instead use Ruby's string formatting syntax.

      For example:

      _("My name is #{name} and my cat is #{get_cat_name("Maggie")})
      

      must become

      _("My name is %{name} and my cat is %{cat_name}") % { name: "Maggie", cat_name: get_cat_name("Maggie") }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              maggie Maggie Dreyer
              Reporter:
              maggie Maggie Dreyer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support