1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular production build with localize

Discussão em 'Angular' iniciado por Othman Fayed, Outubro 15, 2024.

  1. Othman Fayed

    Othman Fayed Guest

    When building production build with localize option, the locale-specific configuration is being ignored. For example when I specify a different index.html in config for "ar" and build using ng build --prod --localize=true the default index.html gets built

    Any idea if there is way to perform this with building separatly for each locale?

    {
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
    "ClientApp": {
    "root": "",
    "sourceRoot": "src",
    "projectType": "application",
    "prefix": "",
    "schematics": {
    "@schematics/angular:component": {
    "style": "scss"
    }
    },
    "architect": {
    "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
    "allowedCommonJsDependencies": [
    "file-saver",
    "lodash/cloneDeep",
    "lodash",
    "xlsx",
    "formiojs",
    "kendo-ui-core/js/kendo.datepicker",
    "@progress/kendo-ui/js/kendo.upload"
    ],
    "aot": true,
    "outputPath": "dist",
    "index": "src/index.html",
    "main": "src/main.ts",
    "polyfills": "src/polyfills.ts",
    "tsConfig": "src/tsconfig.app.json",
    "assets": [
    {
    "glob": "**/*",
    "input": "src/root/",
    "output": "/"
    },
    "src/assets",
    "src/manifest.webmanifest"
    ],
    "styles": [
    "./node_modules/@ng-select/ng-select/themes/default.theme.css",
    "./node_modules/bootstrap/dist/css/bootstrap.css",
    "src/styles/styles.scss"
    ],
    "scripts": [
    "./node_modules/moment/min/moment.min.js",
    "./node_modules/jquery/dist/jquery.min.js",
    "./node_modules/bootstrap/dist/js/bootstrap.min.js"
    ],
    "localize": true
    },
    "configurations": {
    "dev": {
    "budgets": [
    {
    "type": "anyComponentStyle",
    "maximumWarning": "6kb"
    }
    ],
    "fileReplacements": [
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.dev.ts"
    }
    ]
    },
    "production": {
    "fileReplacements": [
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.prod.ts"
    }
    ],
    "optimization": true,
    "outputHashing": "all",
    "sourceMap": false,
    "extractCss": true,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "budgets": [
    {
    "type": "initial",
    "maximumWarning": "2mb",
    "maximumError": "50mb"
    },
    {
    "type": "anyComponentStyle",
    "maximumWarning": "6kb"
    }
    ],
    "serviceWorker": false,
    "ngswConfigPath": "ngsw-config.json"
    },
    "dev-fr": {
    "localize": [
    "fr"
    ],
    "fileReplacements": [
    {
    "replace": "src/i18n/messages.ts",
    "with": "src/i18n/messages.fr.ts"
    },
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.dev.ts"
    }
    ]
    },
    "fr": {
    "localize": [
    "fr"
    ],
    "fileReplacements": [
    {
    "replace": "src/i18n/messages.ts",
    "with": "src/i18n/messages.fr.ts"
    }
    ]
    },
    "hy": {
    "localize": [
    "hy"
    ],
    "fileReplacements": [
    {
    "replace": "src/i18n/messages.ts",
    "with": "src/i18n/messages.hy.ts"
    }
    ]
    },
    "ar": {
    "index": "src/index.ar.html",
    "styles": [
    "./node_modules/@ng-select/ng-select/themes/default.theme.css",
    "./node_modules/bootstrap/dist/css/bootstrap.css",
    "src/styles/styles.scss",
    "src/assets/css/bootstrap-rtl.css"
    ],
    "localize": [
    "ar"
    ],
    "fileReplacements": [
    {
    "replace": "src/i18n/messages.ts",
    "with": "src/i18n/messages.ar.ts"
    }
    ]
    },
    "production-fr": {
    "localize": [
    "fr"
    ],
    "outputPath": "dist",
    "fileReplacements": [
    {
    "replace": "src/i18n/messages.ts",
    "with": "src/i18n/messages.fr.ts"
    },
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.prod.ts"
    }
    ],
    "optimization": true,
    "outputHashing": "all",
    "sourceMap": false,
    "extractCss": true,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "budgets": [
    {
    "type": "initial",
    "maximumWarning": "2mb",
    "maximumError": "50mb"
    },
    {
    "type": "anyComponentStyle",
    "maximumWarning": "6kb"
    }
    ]
    }
    }
    },
    "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
    "browserTarget": "ClientApp:build",
    "sourceMap": true,
    "liveReload": false
    },
    "configurations": {
    "dev": {
    "browserTarget": "ClientApp:build:dev",
    "port": 4321
    },
    "dev-fr": {
    "browserTarget": "ClientApp:build:dev-fr",
    "port": 4321
    },
    "production": {
    "browserTarget": "ClientApp:build:production"
    },
    "fr": {
    "browserTarget": "ClientApp:build:fr"
    },
    "hy": {
    "browserTarget": "ClientApp:build:hy"
    },
    "ar": {
    "browserTarget": "ClientApp:build:ar"
    }
    }
    },
    "extract-i18n": {
    "builder": "@angular-devkit/build-angular:extract-i18n",
    "options": {
    "browserTarget": "ClientApp:build"
    }
    },
    "test": {
    "builder": "@angular-devkit/build-angular:karma",
    "options": {
    "main": "src/test.ts",
    "polyfills": "src/polyfills.ts",
    "tsConfig": "src/tsconfig.spec.json",
    "karmaConfig": "src/karma.conf.js",
    "styles": [
    "src/styles/styles.scss"
    ],
    "scripts": [],
    "assets": [
    "src/favicon.ico",
    "src/assets",
    "src/manifest.webmanifest"
    ]
    }
    },
    "lint": {
    "builder": "@angular-devkit/build-angular:tslint",
    "options": {
    "tsConfig": [
    "src/tsconfig.app.json",
    "src/tsconfig.spec.json"
    ],
    "exclude": [
    "**/node_modules/**"
    ]
    }
    },
    "xliffmerge": {
    "builder": "@ngx-i18nsupport/tooling:xliffmerge",
    "options": {
    "xliffmergeOptions": {
    "i18nFormat": "xlf2",
    "srcDir": "src/i18n",
    "genDir": "src/i18n",
    "defaultLanguage": "en",
    "removeUnusedIds": false,
    "allowIdChange": true,
    "beautifyOutput": true,
    "languages": [
    "en",
    "fr",
    "hy",
    "ar"
    ]
    }
    }
    }
    },
    "i18n": {
    "sourceLocale": {
    "code": "en",
    "baseHref": "/"
    },
    "locales": {
    "fr": {
    "translation": "src/i18n/messages.fr.xlf",
    "baseHref": "/fr/"
    },
    "hy": {
    "translation": "src/i18n/messages.hy.xlf",
    "baseHref": "/hy/"
    },
    "ar": {
    "translation": "src/i18n/messages.ar.xlf",
    "baseHref": "/ar/"
    }
    }
    }
    },
    "ClientApp-e2e": {
    "root": "e2e/",
    "projectType": "application",
    "prefix": "",
    "architect": {
    "e2e": {
    "builder": "@angular-devkit/build-angular:protractor",
    "options": {
    "protractorConfig": "e2e/protractor.conf.js",
    "devServerTarget": "ClientApp:serve"
    },
    "configurations": {
    "production": {
    "devServerTarget": "ClientApp:serve:production"
    }
    }
    },
    "lint": {
    "builder": "@angular-devkit/build-angular:tslint",
    "options": {
    "tsConfig": "e2e/tsconfig.e2e.json",
    "exclude": [
    "**/node_modules/**"
    ]
    }
    }
    }
    }
    },
    }

    Continue reading...

Compartilhe esta Página