title: angular-translate: Translate dynamic value
body: <p>We're using <a href="https://github.com/angular-translate/angular-translate" rel="nofollow">angular-translate</a> to translate our app.</p>
  
  <p>Regular translations with dynamic number values are no problems, like</p>
  
  <pre><code>'LIVES_LEFT': 'You have {{ lives }} left.'
  </code></pre>
  
  <p>used like</p>
  
  <pre><code>&lt;p&gt;{{ 'LIVES_LEFT' | translate:player }}&lt;/p&gt;
  </code></pre>
  
  <p>The problem comes when the dynamic value is a string that itself needs to be translated, like</p>
  
  <pre><code>'YOU_HAVE_A_CHILD': 'You have a {{ gender }} that is {{ age }} years old.'
  </code></pre>
  
  <p>Used like</p>
  
  <pre><code>&lt;p&gt;{{ 'YOU_HAVE_A_CHILD' | translate:child }}&lt;/p&gt;
  </code></pre>
  
  <p><code>gender</code> in this case should end up resolving to 'boy', or 'girl' if the selected language is English, and for example 'Junge', or 'Mädchen', if the selected language is German. How do I do that?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As suggested by Partha Sarathi Ghosh below I tried </p>
  
  <pre><code>&lt;p&gt;{{ 'YOU_HAVE_A_CHILD' | translate:(child | translate) }}&lt;/p&gt;
  </code></pre>
  
  <p>But I get a syntax error from that:</p>
  
  <pre><code>Error: [$parse:syntax] Syntax Error: Token 'Object' is unexpected, expecting []] at column 9 of the expression [[object Object]] starting at [Object]].
  </code></pre>
  
  <p>However, </p>
  
  <pre><code>{
      'YOU_HAVE_A_CHILD': 'You have a {{ gender | translate }} that is {{ age }} years old.',
      'GENDER_BOY': 'boy',
      'GENDER_GIRL': 'girl'
  }
  </code></pre>
  
  <p>used like</p>
  
  <pre><code>&lt;p&gt;{{ 'YOU_HAVE_A_CHILD' | translate:vm.childTranslationData() }}&lt;/p&gt;
  </code></pre>
  
  <p>with Controller code like this:</p>
  
  <pre><code>function childTranslationData() {
      return {
          gender: vm.child.gender === 'boy' ? 'GENDER_BOY' : 'GENDER_GIRL',
          age: vm.child.age
      };
  }
  </code></pre>
  
  <p>worked great! Thanks a lot!</p>