title: Translating module options using apos.i18n?
body: <p>I need an example of using the apostrophe-i18n module inside a custom widgets modules index.js file.</p>
  
  <p>After searching through all of Apostrophes built-in modules, I realized that Apostrophe never uses i18n to translate javascript strings.</p>
  
  <p>I tried the following (found in one module), but it says "self is not defined". How could I import the apostrophe-i18n module to translate my strings in index.js file?</p>
  
  <pre><code>module.exports = {
      extend: 'apostrophe-widgets',
      label: self.apos.i18n.__('Link Page'),
      addFields: {
          name: '_page',
          type: 'joinByOne',
          withType: 'apostrophe-page',
          label: self.apos.i18n.__('Page'),
          required: true,
          idField: 'pageId',
          filters: {
              projection: {
                  title: 1,
                  slug: 1
              }
          }
      }
  };
  </code></pre>
  
  <hr>
  
  <p><strong>Edit for reference:</strong></p>
  
  <p>i18n for module options is not required, since Apostrophe handles the locales for admin strings itself. After adding the widget to an <code>apos.area</code> or <code>apos.singleton</code> call, all strings appear inside <code>locale/en.json</code>, ready for translation (according to my observation).</p>
  
  <p>It seems that <code>apostrophe-i18n</code> uses the browser language to determine the locale to use. This language has to be configured like this in <code>app.js</code>:</p>
  
  <pre><code>'apostrophe-i18n': {
    locales: ['en', 'de']
  },
  </code></pre>
  
  <p>After that, all my translated strings inside <code>locale/de.json</code> were printed to the page.</p>
  
  <hr>
  
  <p>The working code to use <code>self</code> inside modules (again, not needed for i18n):</p>
  
  <pre><code>module.exports = {
  
      construct: function(self, options) {
          options.label = self.apos.i18n.__('Link Page');
      },
  
      extend: 'apostrophe-widgets',
      addFields: [
          {
              name: '_page',
              type: 'joinByOne',
              withType: 'apostrophe-page',
              label: 'Page',
              required: true,
              idField: 'pageId',
              filters: {
                  projection: {
                      title: 1,
                      slug: 1
                  }
              }
          }
      ]
  };
  </code></pre>