Add the fmt_country()
function; update fmt_flag()
#1645
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.
The new
fmt_country()
function has been added here to help with making country names consistent and localizable. The user needs to target cells that contain 2- or 3-letter ISO 3166-1 country codes (same interface as infmt_flag()
). The resulting country names have been obtained from the Unicode CLDR (Common Locale Data Repository), which is a good source since all country names are agreed upon by consensus. Furthermore, the country names can be localized through thelocale
argument (either in this function or through the initialgt()
call).The
fmt_flag()
function was updated to gain alocale
argument so that SVG title text displays country names in any locale language (plus there's full consistency in country names between the two functions). These functions pair well together when you need to display country flags along with the corresponding names.