             err.origError = e
             grunt.fail.warn err
 
-        if not 'i18n' of @options
+        config = {}
+        config.options = @options()
+
+        if not config.options.i18n?
             err = new Error(
                 'You need to configure an `i18n` object in your target'+
                 ' options. See here: https://github.com/SnijderC/'+
                 'grunt-i18n-pug/blob/master/README.md'
             )
             grunt.fail.fatal err
-
 
         gettextFilter = (context) ->
             (text, options) ->

        for locale in i18nConfig.locales
            # Make a duplicate of config (i.e. not byref)
            _config = _.cloneDeep(config)
            # Register __(), __n(), etc. in pugs data namespace
            i18nConfig.register = _config.options.data
            # Configure i18n
            i18n.configure i18nConfig
            # Set the locale
            _config.options.data.setLocale(locale)

            # add a gettext filter
            _config.options.filters = {

                                dest = "#{locale}/#{dest}"
                            # Run callback if any
                            return callbacks[key] src, dest
            target = if @target then "#{@target}_#{locale}" else locale
            grunt.config.set "pug.#{target}", _config
            grunt.task.run ["pug:#{target}"]
