Open mergesort opened 1 week ago
Consider adding support for region-specific language codes such as en-GB English for Great Britain. If an exact match for the region is not found, it should fall back to the generic language code. https://developer.apple.com/documentation/xcode/choosing-localization-regions-and-scripts
This… already works if we're using iOS-standard localisation, right? url(forResource:)
will search .lproj
directories, as used here: https://github.com/mergesort/Recap/blob/f1d2f3d7f04bb3ef7a5f29317a22edcdf8935685/Sources/Recap/Public/ReleasesParser.swift#L180
…I checked, it does indeed already work with no code changes if you're using the Apple-standard way of localising assets.
The suggested method for populating your app's releases with Recap is by using the
ReleasesParser
, to parse and transform a markdown file into releases.But since the
RecapScreen
initializer has a parameter of[Release]
, a developer can provide any source of releases, not necessarily populated from a markdown file.This means that your releases can be generated from code, provided by a remote server or remote file, or created any way you like.
Despite the myriad of ways to load release notes, the most common way to load releases will likely be from a markdown file. Having one markdown file means that there is no way to currently localize the release notes, without writing business logic that looks for a file based on the user's current language.
To simplify the use case of populating releases from a markdown file, I propose creating a naming convention that will allow developers to specify multiple language files, without having to add their own business logic. This pattern would be based around the list of ISO 639-1 language codes.
The developer will specify a filename to load their releases from, with an associated language code. For this example, we will assume that the standard filename is
Releases.md
. To specify your releases notes should be rendered in a language matching the user's localization, we will create a new file with the formatReleases.code.md
.Below are some examples of how a user would name their files, to load localized release notes.
Country codes in the filemane will be case-insensitive, but for convenience's sake, it will be recommended to use lowercase letters to represent the country code.
The localization will be automatic, so the developer will still write this code without having to specify a language.
This will allow Recap to look for a file that matches the user's currently selected language. If no language is found, then it will fall back to the file name without a country code.
As they say in French (fr), voilà.