-
Notifications
You must be signed in to change notification settings - Fork 21
✨ Implement remote configuration settings #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
248a0fd
✨ Implement remote configuration settings
glazrtom e11584d
✨ Upgrade remote configuration settings with select box
glazrtom d5019ce
✨ Improve source type in settings and added tooltip
glazrtom f598d18
✨ Move texts to bundle
glazrtom 850e448
✨ Integrate source configs
glazrtom 0bc7b2f
🐛 Fix plugin initialization
glazrtom 911e6fc
✨ Add translations for bundle
glazrtom 47b2bcb
📝 Add documentation for the custom gitmojis
glazrtom 2c04a2d
✨ Allow empty localization
glazrtom c469313
🐛 Use ConfigUtil for properties
glazrtom 45890d5
🐛 Fix chinese translations
glazrtom 50cd7df
🐛 Fix html tag in bundle message
glazrtom 2ef0915
🐛 Fix fr translation
glazrtom 2ffcdcb
🐛 Fix url for conventional gitmoji
glazrtom 1a15c3c
♻️ Change url field width
glazrtom 0cfbfd3
🐛 Handle issue with finding the correct source type
glazrtom da706f5
✨ Add verification of the url
glazrtom f69f259
🐛 Fix path for custom gitmojis
glazrtom dd85579
🐛 Fix issue with index
glazrtom 031234c
🐛 Fix issue with concurrent array
glazrtom 4d74dec
🐛 Fix url verification
glazrtom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Custom Gitmojis | ||
|
|
||
| This document explains how to customize which Gitmojis the plugin shows, where the plugin looks for the default data, how to provide your own JSON source, and how localization works. | ||
|
|
||
| ## Configuring a custom Gitmoji source | ||
| 1. Open the plugin settings (Settings / Preferences → GitMoji). | ||
| 2. Set source type to "Custom". | ||
| 3. Enter the JSON URL for your custom gitmoji list in the JSON URL field. | ||
| 4. Enter a localization URL template in the Localization URL field. Use `{locale}` as a placeholder that will be replaced with the selected locale (see below). | ||
|
|
||
| The plugin expects a JSON object with a `gitmojis` array. Each element must contain `emoji`, `code`, `description`, and `name` fields. Example: | ||
|
|
||
| ```json | ||
| { | ||
| "gitmojis": [ | ||
| { | ||
| "emoji": "😄", | ||
| "code": ":smile:", | ||
| "description": "A happy smile", | ||
| "name": "smile" | ||
| }, | ||
| { | ||
| "emoji": "✨", | ||
| "code": ":sparkles:", | ||
| "description": "Add new features", | ||
| "name": "sparkles" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| If the HTTP request fails or returns an invalid response, the plugin will silently fall back to the bundled `gitmojis.json` file. | ||
|
|
||
| ### Localization | ||
| - Localized translations are provided as YAML files mapping gitmoji `name` → localized description. | ||
| - Provide YAML translations keyed by `name` (not `code`). The plugin looks up translations by the `name` field from the JSON. | ||
| - If the field is left empty, description from the JSON source is used. | ||
| - The plugin uses a localization URL template that can be included with the `{locale}` token. Example: | ||
|
|
||
| ``` | ||
| https://mydomain.com/gitmojis-{locale}.yaml | ||
| ``` | ||
|
|
||
| - When the plugin loads translations it will replace `{locale}` with the selected language code and try to download that YAML file. Example replacements: | ||
| - `en_US` → https://.../gitmojis-en_US.yaml | ||
| - `fr_FR` → https://.../gitmojis-fr_FR.yaml | ||
| - `zh_CN` → https://.../gitmojis-zh_CN.yaml | ||
|
|
||
| - Supported config language values: | ||
| - `auto` (use system locale if supported, otherwise falls back to `en_US`) | ||
| - `en_US`, `zh_CN`, `fr_FR`, `ru_RU`, `pt_BR` | ||
|
|
||
| YAML structure example: | ||
|
|
||
| ```yaml | ||
| gitmojis: | ||
| smile: "Sourire" | ||
| sparkles: "Ajouter de nouvelles fonctionnalités" | ||
| ``` | ||
|
|
||
| The plugin will try to download remote YAML translations. If the network fetch or parsing fails, it falls back to bundled local YAML resources named `gitmojis-<locale>.yaml` that is shipped with the plugin or description from the json directly. | ||
|
|
||
| ## Default data | ||
| - The plugin ships a bundled default file at [gitmojis.json](./src/main/resources/gitmojis.json). If an HTTP fetch of the configured JSON URL fails, the plugin falls back to this embedded file. | ||
| - Default localization example file can be found at [gitmojis.yaml](./src/main/resources/gitmojis.yaml). | ||
| - The default remote URL used by the plugin for Gitmoji source is https://gitmoji.dev/api/gitmojis | ||
| - There is also a built-in [Conventional Gitmoji](https://conventional-gitmoji.web.app/) option, which is reduced set of Gitmojis matching the [conventional commit](https://www.conventionalcommits.org) specification. | ||
|
|
||
|
|
||
| ## Practical example — host custom JSON and YAML on GitHub | ||
| 1. Create a repository containing `gitmojis.json` in the root and localization files named `gitmojis-fr_FR.yaml`, `gitmojis-zh_CN.yaml`, etc. | ||
| 2. Use GitHub raw URLs for the two fields in the plugin settings. Example: | ||
| - JSON URL: `https://raw.githubusercontent.com/<you>/<repo>/main/gitmojis.json` | ||
| - Localization template: `https://raw.githubusercontent.com/<you>/<repo>/main/gitmojis-{locale}.yaml` | ||
|
|
||
| ## Further reference | ||
| Example of conventional config repo for inspiration: https://github.com/glazrtom/conventional-gitmoji-config | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.