mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-05-09 08:04:13 -04:00
review fixes
This commit is contained in:
@@ -30,7 +30,7 @@ public record CultureInfoDto : IFormattable
|
||||
{
|
||||
}
|
||||
|
||||
public CultureInfoDto(CultureInfo value, string hint, string defaultFormat)
|
||||
public CultureInfoDto(CultureInfo? value, string hint, string defaultFormat)
|
||||
{
|
||||
Original = hint;
|
||||
DefaultFormat = defaultFormat;
|
||||
|
||||
@@ -22,12 +22,12 @@ public partial record RegionInfoDto : IFormattable
|
||||
{
|
||||
}
|
||||
|
||||
public RegionInfoDto(RegionInfo value, string hint, string defaultFormat)
|
||||
public RegionInfoDto(RegionInfo? value, string hint, string defaultFormat)
|
||||
{
|
||||
Original = hint;
|
||||
DefaultFormat = defaultFormat;
|
||||
Value = value;
|
||||
Culture = GetCultureInfo(value);
|
||||
Culture = value is null ? null : GetCultureInfo(value);
|
||||
}
|
||||
|
||||
private static RegionInfo? GetRegion(string input)
|
||||
@@ -60,11 +60,11 @@ public partial record RegionInfoDto : IFormattable
|
||||
[GeneratedRegex(@"\((?<displayName>.+)\)")]
|
||||
private static partial Regex ExtractRegionName();
|
||||
|
||||
private static CultureInfo GetCultureInfo(RegionInfo region)
|
||||
private static CultureInfo? GetCultureInfo(RegionInfo region)
|
||||
{
|
||||
// find culture for region
|
||||
return CultureInfo.GetCultures(CultureTypes.SpecificCultures)
|
||||
.First(c => Equals(new RegionInfo(c.Name), region));
|
||||
.FirstOrDefault(c => Equals(new RegionInfo(c.Name), region));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -224,10 +224,10 @@ You can use custom formatters to construct customized DateTime string. For more
|
||||
|
||||
You can specify which part of a region you are interested in.
|
||||
|
||||
| Formatter | Description | Example Usage | Example Result |
|
||||
|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|--------------------|
|
||||
| \{O \| I \| I2 \| I3 \| E \| N \| W \| ID\} | Formats the region using<br>the region part tags.<br>\{O:[Text_Formatter](#text-formatters)\} = Region as provided by audible<br>\{I:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I2:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I3:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{E:[Text_Formatter](#text-formatters)\} = English name<br>\{N:[Text_Formatter](#text-formatters)\} = Native name - OS dependant<br>\{W:[Text_Formatter](#number-formatters)\} = Unique Windows code<br>\{ID:[Text_Formatter](#text-formatters)\} = Lang code<br><br>Formatter parts are optional and introduced by the colon. If specified the string will be used to format the part using the corresponding formatter.<br><br>Default is \{O\} | `<locale[{I} ({E})]>` | US (United States) |
|
||||
| \{D\} **†** | Display name interpreted by the current language settings.<br>To ensure output in a specific language the lang-code to use might be spcified with a leading '@'.<br>Formatter part is also optional and introduced by the colon.<br>\{D@LANG:[Text_Formatter](#text-formatters)\} | `<locale[{D@es:u}]>` | ESTADOS UNIDOS |
|
||||
| Formatter | Description | Example Usage | Example Result |
|
||||
|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|--------------------|
|
||||
| \{O \| I \| I2 \| I3 \| E \| N \| W \| ID\} | Formats the region using<br>the region part tags.<br>\{O:[Text_Formatter](#text-formatters)\} = Region as provided by audible<br>\{I:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I2:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I3:[Text_Formatter](#text-formatters)\} = Three letter ISO code<br>\{E:[Text_Formatter](#text-formatters)\} = English name<br>\{N:[Text_Formatter](#text-formatters)\} = Native name - OS dependent<br>\{W:[Text_Formatter](#number-formatters)\} = Unique Windows code<br>\{ID:[Text_Formatter](#text-formatters)\} = Region code<br><br>Formatter parts are optional and introduced by the colon. If specified the string will be used to format the part using the corresponding formatter.<br><br>Default is \{O\} | `<locale[{I} ({E})]>` | US (United States) |
|
||||
| \{D\} **†** | Display name interpreted by the current language settings.<br>To ensure output in a specific language the lang-code to use might be specified with a leading '@'.<br>Formatter part is also optional and introduced by the colon.<br>\{D@LANG:[Text_Formatter](#text-formatters)\} | `<locale[{D@es:u}]>` | ESTADOS UNIDOS |
|
||||
|
||||
**†** LANG may be any code from the [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) standard like `es` for Spanish, `en` for English, `de` for German, etc. or even a [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) like 'fr-CA'.
|
||||
|
||||
@@ -235,10 +235,10 @@ You can specify which part of a region you are interested in.
|
||||
|
||||
You can specify which part of a language you are interested in.
|
||||
|
||||
| Formatter | Description | Example Usage | Example Result |
|
||||
|---------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|----------------|
|
||||
| \{O \| I \| I2 \| I3 \| E \| N \| W \| ID\} | Formats the language using<br>the language part tags.<br>\{O:[Text_Formatter](#text-formatters)\} = Language as provided by audible<br>\{I:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I2:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I3:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{E:[Text_Formatter](#text-formatters)\} = English name<br>\{N:[Text_Formatter](#text-formatters)\} = Native name - OS dependant<br>\{W:[Text_Formatter](#number-formatters)\} = Unique Windows code<br>\{ID:[Text_Formatter](#text-formatters)\} = Lang code<br><br>Formatter parts are optional and introduced by the colon. If specified the string will be used to format the part using the corresponding formatter.<br><br>Default is \{O\} | `<language[{I3:l} ({E})]>` | fra (French) |
|
||||
| \{D\} | Display name interpreted by the current language settings.<br>To ensure output in a specific language the lang-code to use might be spcified with a leading '@'.<br>Formatter part is also optional and introduced by the colon.<br>\{D@LANG:[Text_Formatter](#text-formatters)\} | `<language[{D@es}]>` | francés |
|
||||
| Formatter | Description | Example Usage | Example Result |
|
||||
|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|----------------|
|
||||
| \{O \| I \| I2 \| I3 \| E \| N \| W \| ID\} | Formats the language using<br>the language part tags.<br>\{O:[Text_Formatter](#text-formatters)\} = Language as provided by audible<br>\{I:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I2:[Text_Formatter](#text-formatters)\} = Two letter ISO code<br>\{I3:[Text_Formatter](#text-formatters)\} = Three letter ISO code<br>\{E:[Text_Formatter](#text-formatters)\} = English name<br>\{N:[Text_Formatter](#text-formatters)\} = Native name - OS dependent<br>\{W:[Text_Formatter](#number-formatters)\} = Unique Windows code<br>\{ID:[Text_Formatter](#text-formatters)\} = Lang code<br><br>Formatter parts are optional and introduced by the colon. If specified the string will be used to format the part using the corresponding formatter.<br><br>Default is \{O\} | `<language[{I3:l} ({E})]>` | fra (French) |
|
||||
| \{D\} | Display name interpreted by the current language settings.<br>To ensure output in a specific language the lang-code to use might be specified with a leading '@'.<br>Formatter part is also optional and introduced by the colon.<br>\{D@LANG:[Text_Formatter](#text-formatters)\} | `<language[{D@es}]>` | francés |
|
||||
|
||||
### Checks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user