Populating a Subscriber Locale List

You can provide a drop-down list of subscriber locales in your user interface so that users can select valid subscriber locales for their subscriptions. You are not required to include subscriber locale information in the subscription record, because you can collect it from other sources or hard-code it into your notification generation rules.

If you provide a list of subscribers, you can use the SubscriberLocale and SubscriberLocaleEnumeration classes to populate a list with valid values.

The following code example shows how to use a SubscriberLocaleEnumeration object in managed code:

string instanceName = "Tutorial";

// Create the NSInstance object.
NSInstance testInstance = new NSInstance(instanceName);

// Create the SubscriberLocaleEnumeration object.
SubscriberLocaleEnumeration testEnumeration =
    new SubscriberLocaleEnumeration(testInstance);

// Print locale list
foreach (SubscriberLocale thisSubLocale in testEnumeration)
{
    Console.WriteLine(thisSubLocale.Locale);
}

The following VBScript example shows how to use a SubscriberLocaleEnumeration object in unmanaged code:

Dim testInstance, testSubscriberLocaleEnumeration, localeString
const instanceName = "Tutorial"

' Create the NSInstance object.
set testInstance = WScript.CreateObject( _ 
    "Microsoft.SqlServer.NotificationServices.NSInstance")
testInstance.Initialize instanceName

' Create the SubscriptionLocaleEnumeration object.
set testEnumeration = WScript.CreateObject( _ 
"Microsoft.SqlServer.NotificationServices.SubscriberLocaleEnumeration")

testEnumeration.Initialize (testInstance)

' Print the 
for each localeItem in testEnumeration
    localeString = localeString & localeItem.Locale & ", "
next
WScript.Echo localeString

Community Additions

ADD
Show: