Skip to content

Languages support #36

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

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

    APIPublic methods and propertiesFeatureSomething we can add later on without introducing a breaking change

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions