message="The field IETF_TAG does not exist or is not a valid string.";
readLangCultureTag=string.Empty;
returnfalse;
}
if(string.IsNullOrWhiteSpace(readLangCultureTag))
{
message="The field IETF_TAG is empty. Use a valid IETF tag like 'en-US'. The first part is the language, the second part is the country code.";
readLangCultureTag=string.Empty;
returnfalse;
}
if(readLangCultureTag.Length!=5)
{
message="The field IETF_TAG is not a valid IETF tag. Use a valid IETF tag like 'en-US'. The first part is the language, the second part is the country code.";
readLangCultureTag=string.Empty;
returnfalse;
}
if(readLangCultureTag[2]!='-')
{
message="The field IETF_TAG is not a valid IETF tag. Use a valid IETF tag like 'en-US'. The first part is the language, the second part is the country code.";
readLangCultureTag=string.Empty;
returnfalse;
}
// Check the first part consists of only lower case letters:
for(vari=0;i<2;i++)
if(!char.IsLower(readLangCultureTag[i]))
{
message="The field IETF_TAG is not a valid IETF tag. Use a valid IETF tag like 'en-US'. The first part is the language, the second part is the country code.";
readLangCultureTag=string.Empty;
returnfalse;
}
// Check the second part consists of only upper case letters:
for(vari=3;i<5;i++)
if(!char.IsUpper(readLangCultureTag[i]))
{
message="The field IETF_TAG is not a valid IETF tag. Use a valid IETF tag like 'en-US'. The first part is the language, the second part is the country code.";