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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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