Griffon
  1. Griffon
  2. GRIFFON-598

Support reference keys in messages/resources bundles

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.3.0
    • Component/s: rt
    • Labels:
      None
    • Number of attachments :
      0

      Description

      There are times when the value of a resource key must match the value of another key. Reference keys can be used to keep the value defined in a single place.

      Proposed syntax

      famous.quote = This is {0}!
      another.key = @{famous.quote}
      

      Evaluating these keys with different arguments produces

      assert app.getMessage('famous.quote', ['Sparta']) == 'This is Sparta!'
      assert app.getMessage('another.key', ['Griffon']) == 'This is Griffon!'
      

      Conditions:

      • referenced keys must be fully enclosed within '@ {' and '}

        '. Additional characters at either end will make the value to be interpreted as is.

        Activity

        Show
        Andres Almiray added a comment - Fixed with https://github.com/griffon/griffon/commit/9dae50928b764c31ac3fd7b513c603c2bbd19fb2

          People

          • Assignee:
            Andres Almiray
            Reporter:
            Andres Almiray
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: