Answers.Body: <p>Not that I'm aware of. You would have to create a plugin that scrapes all of your template files for translatable strings, that then also makes those strings available to twig templates.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-27T13:31:06.347Z
Answers.LastActivityDate: 2017-04-27T13:31:06.347Z
Answers.UserDisplayName: Mike Pierce
Body: <p>How can I output all translation strings to a javascript object?</p>
  
  <p>Of course I could do it one by one like this:</p>
  
  <pre><code>&lt;script&gt;
  translations.string = {{ "string" | t }};
  
  ...
  &lt;/script&gt;
  </code></pre>
  
  <p>But I want to just loop through all translation strings. Is there some kind of twig object containing all these strings?</p>
  
Tags: <localization>
Title: Output all translation strings to javascript object
ThreadText: # Output all translation strings to javascript object
  
  (Asked by: username_0 on 2017-04-27)
  
  How can I output all translation strings to a javascript object?
  
  Of course I could do it one by one like this:
  
  ```
  <script>
  translations.string = {{ "string" | t }};
  
  ...
  </script>
  
  ```
  
  But I want to just loop through all translation strings. Is there some kind of twig object containing all these strings?
  
  **Tags:** localization
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-27. Score: 1
  
  Not that I'm aware of. You would have to create a plugin that scrapes all of your template files for translatable strings, that then also makes those strings available to twig templates.
  
  
  ---
  
  