Skip to content

Commit

Permalink
chore(sdk): set default credential display locale to en-US (#796)
Browse files Browse the repository at this point in the history
Signed-off-by: Rolson Quadras <[email protected]>
  • Loading branch information
rolsonquadras authored Jul 23, 2024
1 parent d92febd commit ef12d2c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/credentialschema/credentialdisplay.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var (
errClaimValueNotFoundInVC error
)

const defaultLocale = "en-US"

func buildCredentialDisplays(
vcs []*verifiable.Credential,
credentialConfigurationsSupported map[issuer.CredentialConfigurationID]*issuer.CredentialConfigurationSupported,
Expand Down Expand Up @@ -288,7 +290,7 @@ func getMaskedValue(rawValue, maskingPattern, maskingString string) (string, err
// on what is available). If no preferred locale is specified, then the first available locale is used.
func getLocalizedLabel(preferredLocale string, claim *issuer.Claim) (string, string) {
if preferredLocale == "" {
return claim.LocalizedClaimDisplays[0].Name, claim.LocalizedClaimDisplays[0].Locale
preferredLocale = defaultLocale
}

for _, claimDisplay := range claim.LocalizedClaimDisplays {
Expand Down Expand Up @@ -369,9 +371,7 @@ func getOverviewDisplay(
preferredLocale string,
) *CredentialOverview {
if preferredLocale == "" {
return issuerCredentialDisplayToResolvedCredentialOverview(
&credentialConfigurationSupported.LocalizedCredentialDisplays[0],
)
preferredLocale = defaultLocale
}

for i := range credentialConfigurationSupported.LocalizedCredentialDisplays {
Expand Down

0 comments on commit ef12d2c

Please sign in to comment.