|
| 1 | +# 🤝 Contributing to Mushroom Strategy |
| 2 | + |
| 3 | +We love contributions from the community! Whether you're reporting a bug, suggesting a new feature, or submitting code |
| 4 | +changes, your help makes the Mushroom Strategy better for everyone. |
| 5 | + |
| 6 | +Please take a moment to review this guide before making a contribution. |
| 7 | + |
| 8 | +## 📜 Code of Conduct |
| 9 | + |
| 10 | +To ensure a welcoming and inclusive environment, all contributors are expected to adhere to |
| 11 | +our [Code of Conduct](https://github.com/DigiLive/mushroom-strategy/blob/main/CODE_OF_CONDUCT.md). Please read it |
| 12 | +carefully. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## 🐞 Reporting Bugs |
| 17 | + |
| 18 | +Found a bug? That's not ideal, but your report helps us squash it! |
| 19 | + |
| 20 | +1. **Check existing issues:** Before opening a new issue, please search |
| 21 | + our GitHub [Issues](https://github.com/DigiLive/mushroom-strategy/issues) |
| 22 | + or [Discussions](https://github.com/DigiLive/mushroom-strategy/discussions) to see if the bug has already been |
| 23 | + reported. |
| 24 | +2. **Open a new issue:** If it's a new bug, please open |
| 25 | + a [new issue](https://github.com/DigiLive/mushroom-strategy/issues/new?template=bug_report.yml). |
| 26 | +3. **Provide details:** In your report, please include: |
| 27 | + |
| 28 | +* A clear and concise description of the bug. |
| 29 | +* Steps to reproduce the behavior. |
| 30 | +* Expected behavior. |
| 31 | +* Screenshots or animated GIFs (if applicable). |
| 32 | +* Your Home Assistant version and Mushroom Strategy version. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## ✨ Suggesting Features |
| 37 | + |
| 38 | +Have a great idea for a new feature or enhancement? We'd love to hear it! |
| 39 | + |
| 40 | +1. **Check existing suggestions:** Search our GitHub [Issues](https://github.com/DigiLive/mushroom-strategy/issues) |
| 41 | + or [Discussions](https://github.com/DigiLive/mushroom-strategy/discussions) to see if the feature has already been |
| 42 | + requested. |
| 43 | +2. **Open a new issue:** If it's a new idea, open |
| 44 | + a [new issue](https://github.com/DigiLive/mushroom-strategy/issues/new?template=feature_request.yml). |
| 45 | +3. **Describe your idea:** Clearly explain the feature, why you think it's useful, and any potential use cases. |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## 💻 Contributing Code |
| 50 | + |
| 51 | +Want to get your hands dirty with the code? Awesome! We appreciate all code contributions. |
| 52 | + |
| 53 | +1. **Fork the Repository:** Start by forking |
| 54 | + the [DigiLive/mushroom-strategy](https://github.com/DigiLive/mushroom-strategy) repository to your own GitHub |
| 55 | + account. |
| 56 | +2. **Clone Your Fork:** Clone your forked repository to your local machine. |
| 57 | + |
| 58 | + ```bash |
| 59 | + git clone https://github.com/YOUR_USERNAME/mushroom-strategy.git |
| 60 | + cd mushroom-strategy |
| 61 | + ``` |
| 62 | + |
| 63 | +3. **Create a New Branch:** Create a new branch for your feature or bug fix. Use a descriptive name (e.g., |
| 64 | + `feature/my-awesome-feature`, `bugfix/fix-admonition-rendering`). |
| 65 | + |
| 66 | + ```bash |
| 67 | + git checkout -b feature/my-new-feature |
| 68 | + ``` |
| 69 | + |
| 70 | +4. **Set up Development Environment:** |
| 71 | + |
| 72 | + * Ensure you have Node.js and npm installed. |
| 73 | + * Install project dependencies: `npm install` |
| 74 | + * You can build the strategy with `npm run build` (for production) or `npm run build-dev` (for development/testing). |
| 75 | + * Copy the built files to your Home Assistant's `www/community/mushroom-strategy` folder for testing. |
| 76 | +
|
| 77 | +5. **Make Your Changes:** Implement your bug fix or new feature. |
| 78 | +6. **Test Your Changes:** Thoroughly test your changes to ensure they work as expected and don't introduce new issues. |
| 79 | +7. **Commit Your Changes:** |
| 80 | + |
| 81 | + * We follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for clear commit history. |
| 82 | + * Example: `feat: add new card option` or `fix: correct card rendering issue` |
| 83 | + |
| 84 | + ```bash |
| 85 | + git add . |
| 86 | + git commit -m "feat: add super cool new feature" |
| 87 | + ``` |
| 88 | + |
| 89 | +8. **Push to Your Fork:** |
| 90 | + |
| 91 | + ```bash |
| 92 | + git push origin feature/my-new-feature |
| 93 | + ``` |
| 94 | + |
| 95 | +9. **Create a Pull Request (PR):** |
| 96 | + |
| 97 | + * Go to your forked repository on GitHub. |
| 98 | + * You should see a prompt to create a pull request from your new branch to the `main` branch of |
| 99 | + `DigiLive/mushroom-strategy`. |
| 100 | + * Provide a clear title and description for your PR, referencing any related issues. |
| 101 | + * Be prepared to discuss your changes and address any feedback during the review process. |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +## 📄 Improving Documentation |
| 106 | + |
| 107 | +Good documentation is vital! If you find typos, unclear sections, or want to add more examples, please open a pull |
| 108 | +request. The documentation is located in the `docs/` folder of this repository. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## 🌐 Translations |
| 113 | + |
| 114 | +Help us make Mushroom Strategy accessible to more users around the world by contributing and improving translations! |
| 115 | + |
| 116 | +Language tags have to follow [BCP 47](https://tools.ietf.org/html/bcp47). |
| 117 | +A list of most language tags can be found |
| 118 | +here: [IANA subtag registry](http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). |
| 119 | +Examples: fr, fr-CA, zh-Hans. |
| 120 | + |
| 121 | +1. **Check for Existing Translations:** See if your language is already being worked on or exists. |
| 122 | +2. **Locate Translation Files:** Language files are found within the `src/translations` directory. |
| 123 | + Each language has its own `locale.json` file (e.g., `en.json`, `nl.json`, `pt-BR.json`). |
| 124 | +3. **Create or Update:** |
| 125 | + |
| 126 | + * **To create a new language:** Copy an existing `.json` file (e.g., `en.json`), rename it to your language |
| 127 | + code (e.g., `de.json` for German), and translate the property values. |
| 128 | + * **To update an existing language:** Open the `.json` file for your language and update any missing or |
| 129 | + outdated translations. |
| 130 | + |
| 131 | +4. **Submit a Pull Request:** Once your translations are complete, submit a pull request with your changes. Clearly |
| 132 | + state which language you are contributing to or updating. |
| 133 | + |
| 134 | +!!! info |
| 135 | +**Integrating a new Translation:** |
| 136 | + |
| 137 | + * For your new language file to be picked up, it needs to be imported and registered at file |
| 138 | + `src/utilities/localize.ts`. |
| 139 | + * You will need to add an `import` statement for your new `.json` file at the top, following the existing pattern. |
| 140 | + * Then, you'll need to add it to the `languages` map, associating the language code with the imported module. |
| 141 | +
|
| 142 | + **Special Handling for `language-country` Locales:** |
| 143 | + If you are adding a country-specific locale (e.g., `es-ES` for Spanish (Spain) or `en-GB` for English |
| 144 | + (United Kingdom)), you should create a file like `en-GB.json` in the `translations` folder. In |
| 145 | + `src/utilities/localize.ts`, you'll import it similarly and add it to the `languages` map using the full locale |
| 146 | + code. |
| 147 | + Please ensure you follow existing patterns for `language-country` codes, which typically use a hyphen (`-`) + a |
| 148 | + UPPER-cased country code in the file name and an underscore (`_`) + a lower-cased country code in the import key. |
| 149 | + |
| 150 | + !!! example |
| 151 | + ```typescript |
| 152 | + import * as en from '../translations/en.json'; |
| 153 | + import * as pt_br from '../translations/pt-BR.json'; |
| 154 | + |
| 155 | + /** Registry of currently supported languages */ |
| 156 | + const languages: Record<string, unknown> = { |
| 157 | + en, |
| 158 | + 'pt-BR': pt_br, |
| 159 | + }; |
| 160 | + ``` |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## 🙏 Get Support |
| 165 | + |
| 166 | +If you have questions about contributing or need help with your setup, please open |
| 167 | +a [discussion](https://github.com/DigiLive/mushroom-strategy/discussions) on our GitHub repository. |
0 commit comments