{"id":20892830,"url":"https://github.com/commanderxl/locale-path-loader","last_synced_at":"2025-10-04T17:12:01.322Z","repository":{"id":92978738,"uuid":"87546351","full_name":"CommanderXL/locale-path-loader","owner":"CommanderXL","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-08T14:05:53.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-05T04:13:35.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CommanderXL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-07T13:04:48.000Z","updated_at":"2018-04-17T07:27:10.000Z","dependencies_parsed_at":"2023-04-05T04:46:50.166Z","dependency_job_id":null,"html_url":"https://github.com/CommanderXL/locale-path-loader","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"0929610a82f13e10fc6bc66f3d8ef2b9a9113a57"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CommanderXL/locale-path-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderXL%2Flocale-path-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderXL%2Flocale-path-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderXL%2Flocale-path-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderXL%2Flocale-path-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CommanderXL","download_url":"https://codeload.github.com/CommanderXL/locale-path-loader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderXL%2Flocale-path-loader/sbom","scorecard":{"id":32545,"data":{"date":"2025-08-11","repo":{"name":"github.com/CommanderXL/locale-path-loader","commit":"0929610a82f13e10fc6bc66f3d8ef2b9a9113a57"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-14T19:28:38.746Z","repository_id":92978738,"created_at":"2025-08-14T19:28:38.746Z","updated_at":"2025-08-14T19:28:38.746Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278343086,"owners_count":25971400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T10:14:03.533Z","updated_at":"2025-10-04T17:12:01.297Z","avatar_url":"https://github.com/CommanderXL.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 功能说明\n\n* 文件编译阶段完成字符串替换, 在业务代码当中无需再编写过多用以加载不同语言包文件的判断语句\n* 提供自动维护语言`map`表功能。就近原则，在需要进行翻译的地方，编写好`map`，`loader`会遍历所有的文件去维护最终的`map`表。也可以不启用这个功能，还是单独在语言包文件进行手动的维护\n\n## 路径替换\n\n```javascript\n图片路径\n  模板文件中\n  \u003cimg src=\"/static/images/${locale}/loader.png\"/\u003e\n\n  编译后 ---\u003e\u003e\u003e\n  \u003cimg src=\"/static/images/en/loader.png\"/\u003e\n\ncss文件中图片路径\n  .box {\n    background: url('/static/images/${locale}/loader.png')\n  }\n\n  编译后 ---\u003e\u003e\u003e\n  .box {\n    background: url('/static/images/en/loader.png')\n  }\n\nclass属性:\n  \u003cp class=\"box ${locale}\"\u003e\n\n  编译后 ---\u003e\u003e\u003e\n  \u003cp class=\"box en\"\u003e\n```\n\n## Map表\n\n使用`JSON`格式编写\n```javascript\n  模板文件中:\n\n  \u003c!--\n    \u003ci18n\u003e\n      {\n        \"我爱你\": {\n          \"en\": \"I love you \",\n          \"zh\": \"我爱你\"\n        }\n      }\n    \u003ci18n\u003e\n  --\u003e\n\n\n  js文件中:\n\n  /*\u003ci18n\u003e\n  {\n    \"你好\": {\n      \"zh\": \"你好\",\n      \"en\": \"Hello\"\n    }\n  }\n\u003ci18n\u003e*/\n```\n\n`preloader`会遍历文件并根据配置路径生成最终的语言包`lang.json`\n\n```javascript\n{\n  \"en\": {\n    \"我爱你\": \"I love you \",\n    \"你好\": \"Hello\"\n  },\n  \"zh\": {\n    \"我爱你\": \"我爱你\",\n    \"你好\": \"你好\"\n  }\n}\n```\n\n\n## How to\n\n### 参数说明\n\n* inline: Boolean   是否启用内联模式，即使用就近原则，`map`表分散在各文件中，由`loader`去遍历生成最终的`map`表\n* locale: String  语言环境配置, 默认为`zh`\n* outputDir: String 最终`lang.json`语言映射表生成的路径配置(如果开启了`inline`模式需要对此参数进行配置)\n\n### webpack 1.x\n\n```javascript\n  module.exports = {\n    ....\n    preLoaders: [\n      {\n        test: /\\.vue$/,\n        loaders: [\n          'eslint',\n          'locale-path??outputDir=./src/common\u0026locale=en\u0026inline=true'\n        ]\n      } \n    ]\n    ....\n  }\n```\n\n### webpack 2\n\n\n```javascript\n  module.exports = {\n    ....\n    module: {\n      rules: [{\n        test: /\\.vue$/,\n        enforce: 'pre',\n        use: [{\n          loader: 'eslint-loader',\n          ...\n        }, {\n          loader: 'locale-path-loader',\n          options: {\n            locale: 'en',\n            outputDir: './src/common',\n            inline: true\n          }\n        }]\n      }]\n    }\n    ....\n  }\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommanderxl%2Flocale-path-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommanderxl%2Flocale-path-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommanderxl%2Flocale-path-loader/lists"}