BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Slash
Quartz | Level 8

Hi, guys!

     Recently, I learn how to write custom tasks for EG using C#. Now,  I have already finished one, the UI language is English. How to add another language, like the original task:

It has Chinese and English two language.

QQ截图20130124144329.png

What should I do? Hope you guys give me a demo project, Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Eric,

There are a few steps to make this work.  I'll summarize them here and hope that gets you started.  I may write a longer article on this topic if it's of interest.

The way .NET works, you can supply an alternative language for your application user interface by creating a satellite assembly.  In the EG install folder, you'll see these assembly files (DLLs) in culture-specific subfolders (such as zh-CN for Simplified Chinese).

The satellite assemblies are small, and contain only language-specific resources such as message strings and UI pieces, no programming logic.  There are lots of tools and approaches for creating these.   Some are point-and-click localizations tools, or some simply use .NET SDK-level tools.  Here's one resource - but you can search for others: .NET Localization, Part 2: Creating Satellite Assemblies - O'Reilly Media

Satellite assemblies are good only when you actually externalize the localizable pieces outside of the program code.  For the task class (inherited from SAS.Tasks.Toolkit.SasTask), you can put the class into the Designer view in Visual Studio and change the Localizable property to True.  You would do the same for any part of the task that has a UI: Windows forms, controls, etc.

For messages, you will need to put the message strings into a resource file (ex: Resources.resx) and then reference those resources from within your code instead of the literal strings.

With a satellite assembly built, you need to put it in a directory where the .NET runtime will find it.  Usually you place it in a subfolder relative to the location of the task DLL, using the culture-specific name for the folder.  For example, for Traditional Chinese you put place it in a "zh-CN" folder.  If you want one set of resources to serve all Chinese users, you could place it in the more generic "zh" folder.  The .NET runtime will load the most specific resource that it can find to match the current runtime culture.  If none are found, it will fall back to the "culture neutral" resource that is built into the main task DLL (usually English).

I hope that helps as a starting point.

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

Eric,

There are a few steps to make this work.  I'll summarize them here and hope that gets you started.  I may write a longer article on this topic if it's of interest.

The way .NET works, you can supply an alternative language for your application user interface by creating a satellite assembly.  In the EG install folder, you'll see these assembly files (DLLs) in culture-specific subfolders (such as zh-CN for Simplified Chinese).

The satellite assemblies are small, and contain only language-specific resources such as message strings and UI pieces, no programming logic.  There are lots of tools and approaches for creating these.   Some are point-and-click localizations tools, or some simply use .NET SDK-level tools.  Here's one resource - but you can search for others: .NET Localization, Part 2: Creating Satellite Assemblies - O'Reilly Media

Satellite assemblies are good only when you actually externalize the localizable pieces outside of the program code.  For the task class (inherited from SAS.Tasks.Toolkit.SasTask), you can put the class into the Designer view in Visual Studio and change the Localizable property to True.  You would do the same for any part of the task that has a UI: Windows forms, controls, etc.

For messages, you will need to put the message strings into a resource file (ex: Resources.resx) and then reference those resources from within your code instead of the literal strings.

With a satellite assembly built, you need to put it in a directory where the .NET runtime will find it.  Usually you place it in a subfolder relative to the location of the task DLL, using the culture-specific name for the folder.  For example, for Traditional Chinese you put place it in a "zh-CN" folder.  If you want one set of resources to serve all Chinese users, you could place it in the more generic "zh" folder.  The .NET runtime will load the most specific resource that it can find to match the current runtime culture.  If none are found, it will fall back to the "culture neutral" resource that is built into the main task DLL (usually English).

I hope that helps as a starting point.

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Slash
Quartz | Level 8

Thanks, Chirs!

     Satellite assembly is a good thing, I am learning it, now I am familiar with it. If you write a longer article on this topic, that's best!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1467 views
  • 1 like
  • 2 in conversation