Do not capitalise names in DA/NB/NL #185
Merged
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.
In some languages, such as English, holiday names are considered proper nouns and must be capitalised. Other languages, such as Danish, treat them as common nouns (except Kristi himmelfartsdag (Ascension Day) which includes the name of Christ), so they should not be capitalised when used mid-sentence. In Dutch, it is a bit more complicated.
Yasumi currently provides capitalised names for all languages, except Swedish.
I suggest that all translations in Yasumi use the non-capitalised form, when applicable for the specific language. This supports most use cases.
If you need a capitalised name based on a non-capitalised version, you can just take the first letter and convert it into uppercase.
On the contrary, if you only have the capitalised version and need a version suitable for mid-sentence use, you cannot assume that you can just lowercase the first letter. Depending on the language and the specific holiday name in question, the first letter should or should not be lowercased (see e.g. the above mentioned complex rules for Dutch).
This PR covers Danish, Swedish, Norwegian and Dutch (based on my limited understanding of the rules for Dutch). Other languages may need a similar change, but this requires further investigation.
This change may be considered a BC break (despite the precedent for Swedish). If you think this is a serious concern, we could add a global configuration option — e.g.
Yasumi::capitalizeNames(bool $capitalize)
— which controls whethergetName()
should uppercase the first later of all names. The default should be true (for preserving BC). This should only be a temporary measure which is considered deprecated and will be removed in the next major version.