🔍 Code Extractor

class CurrencyInformation

Maturity: 49

A data class that encapsulates currency information including display formatting, language/culture settings, and locale identifiers for UI presentation.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/currency_information.py
Lines:
4 - 17
Complexity:
simple

Purpose

This class serves as a data container for currency-related information needed to properly identify and display currency values in user interfaces. It inherits from ClientValue (likely a base class for client-side data objects) and stores three key pieces of information: a formatted display string showing how the currency appears with sample values, a language/culture name for localization, and an LCID (Locale Identifier) for system-level locale identification. This class is typically used in applications that need to handle multiple currencies and display them according to regional formatting conventions.

Source Code

class CurrencyInformation(ClientValue):
    """Information about a currency necessary for currency identification and display in the UI."""

    def __init__(self, display_string=None, language_culture_name=None, lcid=None):
        """
        :param str display_string: The Display String (ex: $123,456.00 (United States)) for a specific currency
            which contains a sample formatted value (the currency and the number formatting from the web's locale)
            and the name of the country/region for the currency.
        :param str language_culture_name:
        :param str lcid: The LCID (locale identifier) for a specific currency.
        """
        self.DisplayString = display_string
        self.LanguageCultureName = language_culture_name
        self.LCID = lcid

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

display_string: A formatted string example showing how currency values should be displayed, including currency symbol, number formatting, and country/region name. Example format: '$123,456.00 (United States)'. This provides a visual reference for how amounts in this currency should appear in the UI. Can be None if not available.

language_culture_name: A string representing the language and culture identifier, typically in the format 'language-COUNTRY' (e.g., 'en-US', 'fr-FR'). This is used for localization and determining regional formatting rules. Can be None if not specified.

lcid: The Locale Identifier (LCID) as a string, which is a numeric identifier used by Windows and other systems to identify specific locales. For example, '1033' represents English (United States). Can be None if not available.

Return Value

Instantiation returns a CurrencyInformation object with three instance attributes (DisplayString, LanguageCultureName, LCID) set to the provided values or None. The object serves as a data container and does not have methods that return values beyond the inherited ClientValue functionality.

Class Interface

Methods

__init__(self, display_string=None, language_culture_name=None, lcid=None)

Purpose: Initializes a new CurrencyInformation instance with optional currency display and locale information

Parameters:

  • display_string: Optional string showing formatted currency example with country/region name
  • language_culture_name: Optional string representing the language-culture identifier
  • lcid: Optional string representing the Locale Identifier

Returns: None (constructor)

Attributes

Name Type Description Scope
DisplayString str or None Stores the formatted display string showing how currency values should appear in the UI, including sample formatting and country/region name instance
LanguageCultureName str or None Stores the language and culture identifier string used for localization and regional formatting instance
LCID str or None Stores the Locale Identifier (LCID) used by systems to identify specific locales instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue

# Create a CurrencyInformation instance for US Dollars
currency_info = CurrencyInformation(
    display_string='$123,456.00 (United States)',
    language_culture_name='en-US',
    lcid='1033'
)

# Access the attributes
print(currency_info.DisplayString)  # Output: $123,456.00 (United States)
print(currency_info.LanguageCultureName)  # Output: en-US
print(currency_info.LCID)  # Output: 1033

# Create with partial information
euro_info = CurrencyInformation(
    display_string='€123.456,00 (Germany)',
    language_culture_name='de-DE'
)

# Create empty instance
empty_currency = CurrencyInformation()

Best Practices

  • This is a simple data container class with no business logic, so instantiation is straightforward with no special lifecycle considerations.
  • All constructor parameters are optional and default to None, allowing flexible instantiation based on available data.
  • The class uses PascalCase for attribute names (DisplayString, LanguageCultureName, LCID) which suggests it may be serialized to/from a system that uses this naming convention (likely SharePoint/Office 365 APIs).
  • Since this inherits from ClientValue, it likely has serialization/deserialization capabilities provided by the parent class.
  • Instances are immutable in practice - attributes are set during initialization and typically not modified afterward.
  • When using this class, ensure at least one identifier (display_string, language_culture_name, or lcid) is provided for meaningful currency identification.
  • The display_string should follow the format pattern shown in the docstring for consistency across the application.
  • This class is typically instantiated when receiving currency data from Office 365/SharePoint APIs or when preparing currency information to send to these services.

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class CurrencyInformationCollection 76.9% similar

    A collection class that holds a list of CurrencyInformation objects representing supported currencies in SharePoint.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/currency_information_collection.py
  • class LocaleInfo 68.2% similar

    A data class representing locale information for a signed-in user, including their preferred language and country/region settings.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/locale_info.py
  • class FieldCurrency 67.7% similar

    A SharePoint field class that represents currency values, extending FieldNumber with currency-specific formatting capabilities.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/fields/currency.py
  • class Language 64.6% similar

    A data class representing a natural language with its display name, language tag, and locale identifier (LCID).

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sites/language.py
  • class CurrencyList 61.4% similar

    A SharePoint entity class that provides access to the list of supported currencies in SharePoint currency columns.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/currency.py
← Back to Browse