/*
 * @Date: 2018-11-14 11:57:33
 * @Author: Scm <chengqiuhua@erayt.com>
 * @Copyright: 2015-2019 Erayt, Inc.
 * @Description: If you have some questions, please contact: chengqiuhua@erayt.com.
 */
module.exports = function (config, ide='web') {

    let copyTasks = {};
    let i18ns = config.i18n;

    if(typeof i18ns === 'string'){
        i18ns = [i18ns];
    }

    i18ns.forEach(function (i18n) {

        copyTasks[`login_${i18n}`] = {
            expand: true,
            cwd:`<%= meta.base %>/titanOne3.0-${ide}-login/build/M/${i18n}/`,
            src: '**',
            dest: `<%= meta.dest %>/${i18n}`
        };
        copyTasks[`pro_${i18n}`] = {
            expand: true,
            cwd:`<%= meta.project %>/dist`,
            src: ['**'],
            dest: `<%= meta.dest %>/${i18n}/views/index`
        };
 
        copyTasks[`asserts_${i18n}`] = {
            expand: true,
            cwd:'../asserts',
            src: '**',
            dest: `<%= meta.dest %>/${i18n}/views`
        };
        copyTasks[`vendor_${i18n}`] = {
            expand: true,
            cwd:'<%= meta.base %>/titanOne-dll/vendor',
            src: '**',
            dest: `<%= meta.dest %>/${i18n}/views/vendor/js`
        };
        copyTasks[`index_${i18n}`] = {
            expand: true,
            cwd:`<%= meta.base %>/titanOne3.0-${ide}-index/build/<%= config.schema %>/${i18n}`,
            src: ['**','!views/index/**','!views/manage/**','!views/notice/**','!views/vendor/**','!views/test/**'],
            dest: `<%= meta.dest %>/${i18n}`
        };
    });

    return copyTasks;
};
