Attention

You’re viewing an old version of the L’ART Research Assistant documentation. The project has moved to https://lart.readthedocs.io/projects/research-assistant.

lart.utils

On-the-fly client-side translation management for the L’ART Research Client.

This namespace implements functionality to facilitate the on-the-fly translation of user interface elements with strings loaded on-demand from the backend.

Namespaces

lart.utils.UUID

Utilities for working with UUIDs.

Attributes

lart.utils.searchParams

type: URLSearchParams

Shortcut to the URLSearchParams for the current window location.

See also

  • {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams MDN Documentation for URLSearchParams}

lart.utils.UUID.nilUUID

type: string

Nil UUID as hex-string with separators.

lart.utils.UUID.pattern

type: RegExp

RegEx pattern for identifying valid hex-format UUIDs.

lart.utils.UUID.plainNilUUID

type: string

Nil UUID as hex-string without separators.

Functions

static lart.utils.extractLanguageFromVersion(version)

Extract ISO 639-2/3 alpha-3 language code from a version string.

Given an input of the form “XxxYyy_Zzz_CC” where Xxx, Yyy, and Zzz are three-letter ISO 639-2 or ISO 639-3 alpha-3 language codes, and CC is a two-letter country code, this function will return the string Zzz, which is used in the L’ART Research Client to identify the primary display langauage of a test version.

Arguments:
  • version (string) – L’ART test version string of the form “XxxYyy_Zzz_CC”.

Returns:

string|null – Returns three character alpha-3 language code representing the primary display languageof a L’ART test version, or null if the supplied string doesn’t validly encode one.

static lart.utils.UUID.isNilUUID(identifier)

Check whether a UUID in hex format is the Nil UUID.

Arguments:
  • identifier (string)

Returns:

boolean – Returns true if the provided identifier is the Nil UUID (~UUID equivalent of null), with or without separators, false otherwise..

static lart.utils.UUID.isUUID(identifier)

Check whether a string is a valid UUID in hex format.

Arguments:
  • identifier (string)

Returns:

boolean – Returns true if the provided identifier is a valid hex-formated UUID string (with or without separators), false otherwise.