MobileLocalization220FDW
Codeunit 73167911 — Resolves locale, culture, and date/time information for the Mesh mobile app. Used internally by MobileRPCRegistry220FDW before every service call, and available directly when you need locale-aware formatting or date logic.
ApplyUserWorkDate
procedure ApplyUserWorkDate()
Sets WorkDate() to the current user's local calendar date. Called automatically by ExecuteInterfaceHandler() before every RPC service call — do not call this manually inside your service codeunits.
Always use WorkDate() for business date logic, never Today. Because this is called automatically, WorkDate() is already correct when your service runs.
GetLocalDate
procedure GetLocalDate(): Date
Returns the current date in the user's local timezone.
GetLocalDateTime
procedure GetLocalDateTime(): DateTime
Returns the current date and time in the user's local timezone. Used internally by ApplyUserWorkDate.
GetAppCultureTag
procedure GetAppCultureTag(): Text
Returns the IETF culture tag (e.g. "en-US", "nl-NL") derived from the App Locale Code field in Mobile Setup. Falls back to "en-US" if not configured.
Used by the mobile client to format dates and decimals for display.
GetUserCultureTag
procedure GetUserCultureTag(UserId: Code[50]): Text
Returns the IETF culture tag for a specific user, based on the Language Code field in their Mobile User Assignment 220FDW record. Falls back to "en-US" if no assignment or language code exists.
Parameters
| Name | Type | Description |
|---|---|---|
UserId | Code[50] | The BC user ID (typically UserId()) |
GetAssignedLanguageCode
procedure GetAssignedLanguageCode(UserId: Code[50]): Code[10]
Returns the BC Language Code assigned to the user via Mobile User Assignment 220FDW. Returns 'ENU' as default if no assignment exists.
GetCultureTag
procedure GetCultureTag(LanguageCode: Code[10]): Text
Converts a BC Language Code (e.g. 'NLD') to an IETF culture tag (e.g. 'nl-NL') using the Windows Language ID. Returns "en-US" if the language code is not found or has no Windows Language ID.
FormatDateForDisplay
procedure FormatDateForDisplay(DateValue: Date): Text
Formats a date for display using the app-wide locale from Mobile Setup. Returns an empty string for 0D.
This method is for display strings only — labels, info pane fields, summary items. For date values sent as API response data that the client reads back (e.g. expiry date written to workflow state), always use ISO 8601 text format via JsonHelper:
JsonHelper.WriteText(Result, 'expiryDateTok', Format(ExpiryDate, 0, '<Year4>-<Month,2>-<Day,2>'));
SetLanguageByCode
procedure SetLanguageByCode(LanguageCode: Code[10])
Switches the BC GlobalLanguage to the specified Language Code. Used internally during GetPageFlow to translate labels into the user's language before returning the page JSON. Do not call this in service codeunits — language switching is handled by the framework.