assemble/grunt-assemble-i18n

language not being set

thedamon opened this issue · 7 comments

I've copied the info in various working examples but I'm still getting The 'language' parameter is not defined. I'm not totally sure where I should be check it.. I'm not calling the language variable directly like in #35. it's just by virtue of calling the Handlebars i18n helper

My assemble (0.4.3) task looks like this:

assemble: {
  options: {
    flatten: true,
    data: '<%= config.app %>/data/**/*.{yml,json}',
    layout: 'default.hbs',
    layoutdir: '<%= config.app %>/templates/layouts/',
    partials: ['<%= config.app %>/templates/partials/**/*.hbs'],
  },
  pages: {
    files: {
      '.tmp/': ['<%= config.app %>/templates/pages/**/*.hbs']
    },
    options: {
      plugins: [
        'assemble-contrib-i18n',
        'assemble-contrib-permalinks'
      ],
      i18n: {
        languages: [
          'en',
          'fr'
        ],
        templates: [
          "<%= config.app %>/templates/pages/**/*.hbs"
        ]
      },
      permalinks: {
        structure: ':language/index.html'
      }
    }
  }
},

I have data\i18n\fr.yml and data\i18n\en.yml

But I think maybe I'm missing a step

Your grunt looks good. Do you have a repo I can look at?

Btw, what is this part for?

files: {
      '.tmp/': ['<%= config.app %>/templates/pages/**/*.hbs']
},

Not public code unfortunately. the files: option is the page assembly. without it, the assemble task runs but doesn't output any html files (could rename it in src/dest form.. same idea). .tmp is for the watch task. on build we move the files out to the build directory.

I used --verbose to go through, and it looks like it's getting the settings properly, but that data's getting lost somewhere in the assemble task

Here is the verbose log... it looks like it's trying to build things 3 times. I could see not needing that files section you pointed out, but it doesn't process any html without it. https://gist.github.com/thedamon/fdf485ad19db42859e69

What I do instead of the files: section is use the following src: "!*.*"

That fixed it. i18n.templates makes the pages.files/src redundant?

Yes, it's kind of a work around to create a dynamic list of files. The `src: :!." is also a workaround for the fact that assemble (pre 0.6 anyways) requires a source declaration to be present.