localeChangelogPath function

String localeChangelogPath(
  1. String changelog,
  2. String locale
)

Where locale's own notes live, beside changelog.

CHANGELOG.md and de-DE give CHANGELOG.de-DE.md, in the same directory; a name with no .md gets the locale appended, so NOTES gives NOTES.de-DE. The locale is spelled exactly as a store block declares it — de-DE, zh-Hans, pt-BR — because that declaration is the only list of locales there is, and a second spelling would be a second list.

Pure: it says where the file would be, not whether it is there. That is localeNotesSource's question.

Implementation

String localeChangelogPath(String changelog, String locale) {
  final (:directory, :stem, :extension) = _splitChangelog(changelog);
  return '$directory$stem.$locale$extension';
}