CotEditor/CONTRIBUTING.md

145 lines
7.1 KiB
Markdown
Raw Normal View History

2023-09-01 05:02:22 +03:00
# Contributing Guidelines
2014-12-02 11:38:31 +03:00
2023-09-01 05:02:22 +03:00
## General Feedback
2014-12-02 11:38:31 +03:00
2016-10-11 22:15:32 +03:00
Create a new issue on our [Issues page](https://github.com/coteditor/CotEditor/issues). You can write your feedback either in English (recommended) or in Japanese.
2014-12-02 11:38:31 +03:00
2022-07-05 18:14:23 +03:00
2024-01-14 04:42:46 +03:00
### Issue reports
2022-07-05 18:14:23 +03:00
2024-01-14 04:42:46 +03:00
Search for existing issues first. If you find your issue previously reported, post your case to that issue; otherwise, create a new one by filling up the “Bug report” template. Do not hesitate to post the same phenomenon to the existing issue as long as the cases are less than 10. Multiple instances help a lot to find out the cause. In that situation, include your environment (versions of both CotEditor and macOS) in your post.
2022-07-05 18:14:23 +03:00
If possible, attach screenshots/screencasts of the issue you face. It is also helpful to attach sample files that can reproduce the issue.
2022-07-05 19:30:54 +03:00
If your issue relates to the syntax highlight, include the sample code that can reproduce the unwanted highlight in your post.
2022-07-05 18:14:23 +03:00
2022-07-05 19:30:54 +03:00
### Feature requests
2022-07-05 18:14:23 +03:00
2024-01-14 04:42:46 +03:00
Search for existing requests first. If you find your feature previously requested, post your comment to that issue; otherwise, create a new one by filling up the “Feature request” template.
Create an issue per feature instead of listing multiple features in a single post.
2014-12-02 11:38:31 +03:00
2023-09-01 05:02:22 +03:00
## Pull-Request
2014-12-02 11:38:31 +03:00
2014-12-02 11:48:05 +03:00
### General Code Improvements
2014-12-02 11:38:31 +03:00
2019-04-01 06:34:35 +03:00
Bug fixes and improvements are welcome. If you want to add a new feature or the change is huge, it's better at first to ask the team whether your idea will be accepted.
2014-12-02 11:38:31 +03:00
By adding code, please follow our coding style guide below.
2014-12-02 11:38:31 +03:00
### Localization
2024-01-14 04:42:46 +03:00
_2023-08-01: CotEditor project now gradually migrates the localization format to the strings catalog that is newly introduced in Xcode 15. We will update the technical localization policy when the migration has completely done._
2023-08-01 06:40:20 +03:00
2022-01-31 09:34:09 +03:00
Fixing/updating existing localizations is always welcome. The project team adds `FIXME:` tag as a comment in the localized strings files if there are updated strings to be localized.
2014-12-02 11:38:31 +03:00
2024-01-14 04:42:46 +03:00
If your localization makes some layout in views destroy, try first making the sentence shorter. However, if it's impossible, then just tell us about it with a screenshot when you make a pull-request. We'll update the view to layout your localized text correctly.
2014-12-02 11:38:31 +03:00
2016-10-11 22:15:32 +03:00
#### Submitting a new localization
2014-12-02 11:38:31 +03:00
Currently, the CotEditor project only accepts new localizations whose provider can maintain the localization thereafter. Please explicitly tell us if you also intend to be a localization maintainer when submitting a new localization. The standard maintenance process of a localization is described in the subsection below.
To create a new localization, copy one of a whole .lproj directory and use it as a template. We recommend using `CotEditor/en-GB.lproj/` directory because they are always up-to-date. In addition, add localization also to the .xcstrings files in the `mul.lproj` directory.
2024-01-14 04:42:46 +03:00
Note that you don't need to localize the Unicode block names in the `UnicodeBlock.strings` file. It will be done by @1024jp based on the localization data by Apple.
### Localization maintenance process
2024-01-14 04:42:46 +03:00
A standard localization update proceeds as follows:
1. When CotEditor has new strings to be localized, the CotEditor maintainer, @1024jp, creates a new ticket on GitHub Issues and mentions the localization maintainers in it so that they can keep all their localized strings up to date. The ticket includes all strings to be updated and their descriptions, sometime with screenshots. e.g. [#1519](https://github.com/coteditor/CotEditor/issues/1519).
2. The localizers either post the localized strings to the thread or make a pull request on GitHub. The maintainers should localize the updated strings within about one week (the shorter period is, of course, welcome, but not required). All the responses must be done on GitHub. Not par email.
3. The CotEditor maintainer reviews and merges the update provided by the localizers.
2024-01-14 04:42:46 +03:00
Localization updates may happen once par few months, in general. If a maintainer wants to decline further ongoing maintenance for some reason, it would be kind to express their intentions to the maintainer via email or something. In that case, I will contact the community to find a new maintainer.
2014-12-02 11:38:31 +03:00
2019-04-01 06:34:35 +03:00
Currently, we already have maintainers for:
2016-10-11 22:15:32 +03:00
2024-01-27 08:54:03 +03:00
- English (UK)
2016-10-11 22:15:32 +03:00
- Simplified Chinese
- Traditional Chinese
2023-09-29 07:36:38 +03:00
- Czech
- French
2024-01-27 08:54:03 +03:00
- German
- Italian
- Japanese
2022-05-16 03:48:57 +03:00
- Portuguese
- Turkish
2019-04-01 06:34:35 +03:00
2022-05-16 03:48:57 +03:00
#### Localization for the App Store
2019-04-01 06:34:35 +03:00
CotEditor project is also asking for localization of description on the Mac App Store. We have a separate repository for it at [coteditor/Documents-for-AppStore](https://github.com/coteditor/Documents-for-AppStore).
2016-10-11 22:15:32 +03:00
#### Hints on localization
By localization, use macOS standard terms. It may be helpful to study native Apple applications like TextEdit.app or System Settings to know how Apple localizes terms in their apps.
Especially, follow the terms of the following applications:
- Menu item titles in TextEdit.app
- Find panel in Pages.app
- Some setting messages in ScriptEditor.app
Furthermore, we recommend to utilize [Apple Localization Terms Glossary for macOS](https://applelocalization.com/macos) by Kishikawa Katsumi to find macOS-friendly expressions. This service enables us to search in the texts localized by Apple for macOS apps and frameworks.
You also need to take care of how Apple treats punctuation characters and symbols. For example, regarding quotation marks, they normally prefer the typographer's ones.
2014-12-02 11:38:31 +03:00
2023-05-10 14:29:29 +03:00
### Syntaxes
2014-12-02 11:38:31 +03:00
2023-05-10 14:29:29 +03:00
#### Adding a new bundled syntax
2014-12-02 11:38:31 +03:00
2023-05-10 14:29:29 +03:00
Put just your new syntax into `/CotEditor/syntaxes/` directory. You don't need to modify `SyntaxMap.json` file. It's generated automatically on the build.
2014-12-02 11:38:31 +03:00
2023-05-10 14:29:29 +03:00
The license for the bundled syntaxes must be "Same as CotEditor".
2014-12-02 11:38:31 +03:00
2023-05-10 14:29:29 +03:00
If the syntax language is relatively minor, we recommend you not to bundle it to CotEditor but to distribute it as an additional syntax in your own way, and just add a link to our [wiki page](https://github.com/coteditor/CotEditor/wiki/Additional-Syntax-Styles).
2014-12-02 11:38:31 +03:00
### Themes
2022-05-16 03:48:57 +03:00
We don't accept pull requests adding bundled themes at the moment. You can distribute yours as an additional theme in your own way, and add a link to our [wiki page](https://github.com/coteditor/CotEditor/wiki/Additional-Themes).
2014-12-02 11:38:31 +03:00
### Graphics Resources
2024-01-14 04:42:46 +03:00
We don't accept pull requests for image resources. @1024jp enjoys creating and brushing up the graphics ;). If you find a graphic resource having some kind of mistake to be fixed, please just point out on the Issues page.
2014-12-02 11:38:31 +03:00
2023-08-01 06:40:20 +03:00
2023-09-01 05:02:22 +03:00
## Coding Style Guide
2014-12-02 11:38:31 +03:00
Please follow the style of the existing codes in CotEditor.
2016-10-07 14:24:28 +03:00
- Respect the existing coding style.
2014-12-02 11:38:31 +03:00
- Leave reasonable comments.
2023-05-07 12:09:51 +03:00
- Never omit `self` except in `willSet`/`didSet`.
2024-01-14 04:42:46 +03:00
- Add `final` to classes and extension methods by default.
2016-08-01 13:50:35 +03:00
- Insert a blank line after class/function statement line.
2022-05-16 03:48:57 +03:00
```Swift
/// say moof.
func moof() {
print("moof")
}
```
2016-08-01 13:50:35 +03:00
- Don't declare `@IBOutlet` properties with `!`.
2022-05-16 03:48:57 +03:00
```Swift
2016-10-07 14:24:28 +03:00
// OK
2016-08-01 13:50:35 +03:00
@IBOutlet private weak var button: NSButton?
// NG
@IBOutlet private weak var button: NSButton!
2022-05-16 03:48:57 +03:00
```
- Write the `guard` statement in one-line if just return a simple value.
```Swift
2016-10-07 14:24:28 +03:00
// prefer
2023-01-28 11:10:05 +03:00
guard !foo.isEmpty else { return nil }
2016-08-01 13:50:35 +03:00
// instead of
2023-01-28 11:10:05 +03:00
guard !foo.isEmpty else {
2016-08-01 13:50:35 +03:00
return nil
}
2022-05-16 03:48:57 +03:00
```