Registering New Custom Culture on Windows for .Net Web Application

74 views Asked by At

So recently I have needed to have my web application available to users in Saudi Arabia. We got them set up in ar-SA but that presented some problems as the base calendar and symbols weren't what we wanted. So we decided to try and create a new culture, but when I try to register a culture with code ar-SAR or ar-ZZ (Just trying anything here), the same code succeeds registering it on 1 server (windows server 2019) but fails on another server (windows server 2012R2)

Why is it failing?

Here is the script to register the new culture:
(We compile the script using "csc /r:sysglobl.dll culture.cs" in the command line, and then executing the .exe created)

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Globalization;
    using System.Threading.Tasks;

    namespace CultureRegistration
    {
        class CultureLdml
        {
            static void Main(string[] args)
            {
            CultureAndRegionInfoBuilder carib = CultureAndRegionInfoBuilder.CreateFromLdml("ar-ZZ.ldml");
                carib.Register();
            }
        }
    }

Which is failing with error:

Unhandled Exception: System.Xml.Schema.XmlSchemaValidationException: Culture is
not supported.
Parameter name: name
ar-ZZ is an invalid culture identifier. ---> System.Globalization.CultureNotFoun
dException: Culture is not supported.
Parameter name: name
ar-ZZ is an invalid culture identifier.
   at System.Globalization.CultureInfo.GetCultureInfo(String name)
   at System.Globalization.CultureXmlReader.ReadIdentityElement()
   at System.Globalization.CultureXmlReader.Parse()
   at System.Globalization.CultureXmlReader..ctor(String fileName)
   --- End of inner exception stack trace ---
   at System.Globalization.CultureXmlReader..ctor(String fileName)
   at System.Globalization.CultureAndRegionInfoBuilder.CreateFromLdml(String xmlFileName)
   at CultureRegistration.CultureLdml.Main(String[] args)

Thank you

0

There are 0 answers