title: react native handle translations and languages
body: <p>How do you handle translation in react native? This is how i did it. Is it bad coding style or has it bad performance?</p>
  
  <p><strong>Language.js</strong></p>
  
  <pre><code>export default {
      appName: "TestApp",
      welcome: {
          header: {
              title: (l) =&gt; {
                  switch (l) {
                      case "de": return `germanTitle`
                      case "en": return `englishTitle`
                  }
              },
              subtitle: (l) =&gt; {
                  switch (l) {
                      case "de": return `germanSubtitle`
                      case "en": return `englishSubtitle`
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>then in my app </p>
  
  <pre><code>import language from "./language.js"
  let lang = "de"
  ...
  
  render(){
      return (
          &lt;View&gt;
              &lt;Text&gt;{language.welcome.title(lang)}&lt;/Text&gt;
          &lt;/View&gt;
      )
  }
  </code></pre>