E07150: text method missing for language variant

Category: E07xxx Full resolution · Reported in phase: FULL_RESOLUTION · Classification: TEXT_METHOD_MISSING · All error codes

What went wrong

A text block (for internationalization) is missing implementation for one or more required language variants.

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. Add implementation for each required language
  2. Check which languages are configured for your project
  3. Ensure all text methods have all language variants

Common causes

  • Forgot to add method for specific language
  • New language added but text not translated
  • Incomplete internationalization

See also

  • E07150: text block missing language variant (this error)
  • E07160: non-abstract method missing body

Examples

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

Fails with E07150: text method missing for language variant

#!ek9
defines module error.e07150.bad

  defines record
    Person
      firstName <- String()
      lastName <- String()

      Person() as pure
        ->
          firstName String
          lastName String

        require firstName? and lastName?

        this.firstName :=? String(firstName)
        this.lastName :=? String(lastName)

      default operator ?

  defines text for "en_GB"

    //This text type has a missing method, that is present in the "de version"
    WelcomePageText

      namedWelcome()
        -> person as Person
        `Welcome ${person.firstName}`

  defines text for "de"

    WelcomePageText
      namedWelcome()
        -> person as Person
        `Willkommen ${person.firstName}`

      //Deliberately add method here but not for en_GB
      namedWelcome()
        -> name as String
        `Willkommen ${name}`

Fixed: Every locale provides every text method

#!ek9
defines module error.e07150.good

  defines text for "en_GB"

    WelcomePageText
      formalWelcome()
        -> name as String
        `Good day ${name}`

      namedWelcome()
        -> name as String
        `Welcome ${name}`

  defines text for "de"

    WelcomePageText
      formalWelcome()
        -> name as String
        `Guten Tag ${name}`

      namedWelcome()
        -> name as String
        `Willkommen ${name}`

Questions and answers

These Q&A entries show E07150 and its fix: