E07155: text type already defined for this locale

Category: E07xxx Full resolution · Reported in phase: SYMBOL_DEFINITION · Classification: DUPLICATE_TEXT_TYPE_FOR_LOCALE · All error codes

What went wrong

A text type with the same name has already been defined for this locale. Each text type name must appear only once per locale within a module. Defining the same text type name twice for the same locale is ambiguous and not permitted.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 113 (How does the text construct work for internationalization?)

How to fix it

  1. Rename the duplicate text type to a unique name
  2. Or merge the methods into the first text type definition
  3. Ensure each text type name appears only once per locale

Common causes

  • Copy-paste of text block without changing the type name
  • Accidentally defining same text type in two separate text blocks for same locale
  • Merging code that independently added text for the same locale

See also

  • E07150: text method missing for language variant

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E07155: text type already defined for this locale

#!ek9
defines module error.e07155.bad

  defines text for "en"
    Greetings
      hello()
        "Hello!"

  defines text for "en"

    //Greetings is already defined for "en"
    Greetings
      goodbye()
        "Goodbye!"

Fixed: One text type per locale: put every method in it

#!ek9
defines module error.e07155.good

  defines text for "en"
    Greetings
      goodbye()
        "Goodbye!"

      hello()
        "Hello!"

  defines text for "de"
    Greetings
      goodbye()
        "Auf Wiedersehen!"

      hello()
        "Hallo!"

Questions and answers

These Q&A entries show E07155 and its fix: