diff --git a/PUBLISH.md b/PUBLISH.md new file mode 100644 index 0000000..1efaa17 --- /dev/null +++ b/PUBLISH.md @@ -0,0 +1,48 @@ +# How to publish packages + +1. Enter the master branch and check that pipelines are green + +```bash +git checkout master +``` + +2. reset your current master branch to the latest state by + +```bash +git fetch +git reset origin/master --hard +``` + +3. Checkout a new branch that we'll release versions from + +```bash +git checkout -b release-new-version-[a-b-c] +``` + +4. Start the publishing procedure (\*\*) + 1. Check the current version using `npm version` + 2. Update the version you would to like to publish `npm version [version] # version -> major, minor, patch ... version` + 3. Push the branch `git push` + + +5. Publish the package. + +```bash +npm publish +``` + +6. Open a PR of your release branch and get an approval to finally merge the release it into master + +```bash +git checkout master && git reset origin/master --hard +git merge origin/release-new-version-[a-b-c] --ff-only +git push origin master +``` + +7. Create a release note (Use template from older release tags https://github.com/signavio/i18n/releases) + + 1. Add summary: Describe the changes/packages of this release + 2. Add the release tag created in the previous steps: (v1.2.0) + 3. Add title: # release of i18n packages + +8. Great Job! You've done it. 🎉 diff --git a/README.md b/README.md index 19dbd66..c6baca0 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,7 @@ Create the file `.i18nrc` and add a configuration object for gettext message ext } ``` - -**IMPORTANT:** when the second command line argument is passed to the `i18n-extract` command, it will overwrite the `fileName` field of the `.i18nrc` config. +**IMPORTANT:** when the second command line argument is passed to the `i18n-extract` command, it will overwrite the `fileName` field of the `.i18nrc` config. More available options are documented here: https://github.com/getsentry/babel-gettext-extractor @@ -166,7 +165,9 @@ i18n('I want _this_ to be **bold**', { ``` ### Replacements + #### Extrtaction + Sometimes there may be cases when you need to rename several entities across the whole project, but keep the both versions of translations and show them based on the feature flag. Doing that manually could be laborious, that's why `i18n-extract` supports a path to the replacements json as an optional third command line argument. @@ -184,7 +185,7 @@ Values of each context are objects for the original translation strings and the ```json { - "some context" : { + "some context": { "Old translation": "New translation", "Old translation2": "New translation2" } @@ -195,22 +196,22 @@ If the translation does not have the context, then it should be stored in the `" ```json { - "" : { - "Old translation": "New translation without context", + "": { + "Old translation": "New translation without context" }, "some context": { - "Old translation": "New translation with some context", + "Old translation": "New translation with some context" } } ``` +Having the original JS code: -Having the original JS code: ```javascript // translators: comment 1 -i18n('Old translation'); +i18n('Old translation') // translators: comment 2 -i18n('Old translation2'); +i18n('Old translation2') ``` The .pot file will have the following content @@ -235,6 +236,7 @@ msgstr "" ``` #### Usage + To use the replacements instead of the old strings in runtime pass the same replecements object which was used in the extraction step to the `init` function: ```javascript @@ -252,6 +254,9 @@ init(getLangLoader, config, replacements).then(() => { }) ``` +### Publishing Packages + +Read the following [guide](PUBLISH.md) to publish packages of the i18n repository [build-badge]: https://circleci.com/gh/signavio/i18n/tree/master.svg?style=shield&circle-token=:circle-token [build]: https://circleci.com/gh/signavio/i18n/tree/master