Dynamics 365 Business Central: Insert value in different languages via AL

Dynamics 365 Business Central

Hi, Readers.
Today I would like to share a mini tip in multi-language development, how to insert value in different languages according to different languages.
For example, sometimes we need to insert some fixed text in the code.

First of all, the best practice is to do it by XLIFF translation files.
For example,

More details: XLIFF translation files (Working with Translations)
Test video:

But if you don’t want to use a translation file, you can actually do it as simply as below. This result is the same as above.
GlobalLanguage([Integer]) Method: Gets and sets the current global language setting.

PS: Dynamics 365 Business Central: List of Language IDs (1041,1033…) and Locale IDs (ja-JP,en-US…)

Although it is very simple, this can solve a problem. Under the same language setting, text in different languages can be inserted according to different situations.
Let’s see another simple example. Insert values in different languages according to the Language Code on the Customer Card.

For example,

Test video:

Very simple. However, it is not a good practice to write languages other than English directly in the code. I personally recommend using translation files if you can. And Microsoft no longer recommends using the ML versions of properties (CaptionML, OptionCaptionML…..).
Give it a try!!!😁

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL