{"id":18582945,"url":"https://github.com/messageformat/properties-loader","last_synced_at":"2025-10-30T22:34:38.264Z","repository":{"id":29358722,"uuid":"121396746","full_name":"messageformat/properties-loader","owner":"messageformat","description":"Locale Property Resource Bundle Loader for Webpack","archived":false,"fork":false,"pushed_at":"2023-01-09T13:56:45.000Z","size":27,"stargazers_count":3,"open_issues_count":2,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T23:42:55.774Z","etag":null,"topics":["dot-properties","messageformat","webpack"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/messageformat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T15:07:11.000Z","updated_at":"2023-08-14T07:06:24.000Z","dependencies_parsed_at":"2023-01-14T14:46:05.759Z","dependency_job_id":null,"html_url":"https://github.com/messageformat/properties-loader","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messageformat%2Fproperties-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messageformat%2Fproperties-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messageformat%2Fproperties-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/messageformat%2Fproperties-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/messageformat","download_url":"https://codeload.github.com/messageformat/properties-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208689,"owners_count":21065205,"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","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":["dot-properties","messageformat","webpack"],"created_at":"2024-11-07T00:17:22.432Z","updated_at":"2025-10-30T22:34:33.207Z","avatar_url":"https://github.com/messageformat.png","language":"JavaScript","readme":"# Property Resource Bundle Loader for Webpack\n\nLoads .properties files into JavaScript as precompiled functions using [dot-properties] and [messageformat].\n\nProperty values are parsed directly as ICU MessageFormat. With the default options, will assume that the filename has `_` separated parts, of which the second is the two- or three-letter language code [as in Java Resource Bundles].\n\n[dot-properties]: https://www.npmjs.com/package/dot-properties\n[messageformat]: https://messageformat.github.io/\n[as in java resource bundles]: https://docs.oracle.com/javase/9/docs/api/java/util/ResourceBundle.html#getBundle-java.lang.String-java.util.Locale-java.lang.ClassLoader-\n\n## Installation\n\n```sh\nnpm install messageformat-properties-loader\n```\n\n## Usage\n\nFor a working demo of the following, run `npm install \u0026\u0026 npm run build` in the [`example/`](./example/) directory, and then open `example/dist/index.html` in a browser.\n\n#### Webpack configuration\n\n```js\n{\n  test: /\\.properties$/,\n  loader: 'messageformat-properties-loader',\n  options: {\n    biDiSupport: false,  // enables bi-directional text support\n    defaultLocale: 'en', // used if resolution from filename fails\n    encoding: 'auto',    // .properties file encoding, use one of\n                         // 'auto', 'latin1', or 'utf8'\n    keyPath: false,      // if true, dots '.' key names will result\n                         // in multi-level objects -- use a string\n                         // value to customize\n    pathSep: '_'         // separator for parsing locale from filename\n  }\n}\n```\n\nDefault option values are shown above, though none are required.\n\n#### messages_en.properties\n\n```\nerrors.confirmation: {src} doesn't match {attribute}\nerrors.accepted: {src} must be accepted\nerrors.wrong_length: {src} is the wrong length (should be {count, plural, one{1 character} other{# characters}})\nerrors.equal_to: {src} must be equal to {count}\n```\n\n#### example.js\n\n```js\nimport messages from './messages_en.properties'\n\nmessages.errors.accepted({ src: 'Terms' })\n// 'Terms must be accepted'\n\nmessages.errors.wrong_length({ src: 'Foo', count: 42 })\n// 'Foo is the wrong length (should be 42 characters)'\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmessageformat%2Fproperties-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmessageformat%2Fproperties-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmessageformat%2Fproperties-loader/lists"}