Skip to content

Languages support #36

Closed
Closed

Description

@wojciechczerniak

Description

The only small change proposed here is to add language name and language code.

  • Add language code
  • If the specified language is not found, fallback to default, English.
  • If a function is not translated it cannot be used. Return error as for unknown formula.
  • Add test for language files that compare language.functions keys with registeredPlugins keys
  • Language should be set as language code in Config Global settings #58
    language: enGB,

Language definition

const lang: LanguageDefinition = {
  languageCode: 'pl-PL',
  errors: {
    DIV_BY_ZERO: '#DZIEL/0!',
    NAME: '#NAZWA?',
    VALUE: '#ARG!',
    NUM: '#LICZBA!',
    NA: '#N/A',
    CYCLE: '#CYKL!',
    REF: '#ADR!',
  },
  interface: {
    NEW_SHEET_PREFIX: 'Arkusz'
  },
  functions: {
    'SUM': 'SUMA',
    'ADD': 'DODAJ',
    // ... more functions
  },
}

API proposal

public static registerLanguage(lang: LanguageDefinition): void;
public static getLanguage(name: string): LanguageDefinition;
public static getLanguages(): string[]; // ['pl-PL', 'en-GB', ...]

Activity

  1. changed the title [-]Language and culture support[/-] [+]Languages support[/+] on Nov 26, 2019
  2. added
    API
    Feature
    on Dec 10, 2019
  3. izulin commented on Mar 3, 2020

    @izulin
    Contributor

    To be remembered -- after language rework, we should add a sanity check in config initialization (see #146 )

  4. assigned and unassigned on Mar 13, 2020
  5. izulin commented on Mar 19, 2020

    @izulin
    Contributor

    from #260 : "we could introduce a method getTranslation('interface.NEW_SHEET_PREFIX') to be sure the getter is unit tested correctly and we have fallbacks in place.

    Right now I see here possible three null exceptions"

  6. wojciechczerniak commented on Apr 5, 2020

    @wojciechczerniak
    ContributorAuthor

    Unfortunately, this is not done yet. Please, see the review: #263 (review) for details

  7. wojciechczerniak commented on Apr 7, 2020

    @wojciechczerniak
    ContributorAuthor

    Done in #263 and #287

  8. added a commit that references this issue on Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIFeature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions