question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchLanguageError: No known languages found for specification English.

See original GitHub issue
  • Version: 22.10.5
  • Electron Version: 8.5.5
  • Electron Type (current, beta, nightly):
  • Target: macOS

If I try to build our application with electron-builder it fails with the following exception:

  ⨯ No known languages found for specification English.  stackTrace=
                                                           NoSuchLanguageError: No known languages found for specification English.
                                                               at Function.bySpec (/Users/dmey/workspace/drive/node_modules/dmg-license/lib/Language.js:35:19)
                                                               at Object.indexByLanguage (/Users/dmey/workspace/drive/node_modules/dmg-license/lib/Language.js:81:41)
                                                               at labelCache (/Users/dmey/workspace/drive/node_modules/dmg-license/lib/assembleLicenses.js:92:35)
                                                               at Object.assembleLicenses [as default] (/Users/dmey/workspace/drive/node_modules/dmg-license/lib/assembleLicenses.js:117:23)
                                                               at dmgLicensePlist (/Users/dmey/workspace/drive/node_modules/dmg-license/lib/index.js:27:78)
                                                               at dmgLicense (/Users/dmey/workspace/drive/node_modules/dmg-license/lib/index.js:21:62)
                                                               at dmgLicenseFromJSON (/Users/dmey/workspace/drive/node_modules/dmg-license/lib/index.js:37:18)
                                                               at addLicenseToDmg (/Users/dmey/workspace/drive/node_modules/dmg-builder/src/dmgLicense.ts:57:9)

The exact same configuration is working on a workmates device.

We have a license_de.rtf, license_en.rtf, licenseButtons_de.json and a licenseButtons_en.json in our build directory.

Thanks for your help, best regards, Dominic

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16

github_iconTop GitHub Comments

2reactions
argv-minus-onecommented, May 13, 2021

I borrowed a Mac and successfully reproduced your problem.

Problems

There are two things going on here:

  1. The licenseButtons property lang is supposed to be a language tag (like en-us), but the documentation says to put a language name (like English) there. Doing this results in the error message you originally reported: No known languages found for specification English. I’ve opened issue #5887 about that.
  2. The code that parses the language tag out of your file name doesn’t work correctly if you put a dash in it (as in languageButtons_en-us.json). electron-builder expects an underscore between the language and country (as in languageButtons_en_us.json), presumably for backward compatibility reasons. Putting a dash there results in the error message you reported just now: No known languages found for specification en-us-EN-US.

Solutions

  • Remove the lang property from all licenseButtons files. It’s not needed with electron-builder and can only cause confusion.
  • Rename all license files such that the language tag contains only underscores, not dashes: license_en_us.rtf, licenseButtons_en_us.json, license_de_de.rtf, licenseButtons_de_de.json.

Giving a Language Name

You can give a language name in the licenseButtons file (though it’s optional, except for languages marked “requires languageName” in the list). It goes in the languageName property, not lang. Example:

{
  "languageName": "English, do you speak it",
  "agree": "Agree",
  "disagree": "Disagree",
  "print": "Print",
  "save": "Save",
  "description": "Here is my own description"
}

However, I don’t think current macOS actually displays the language name anywhere. It still expects a language name to appear in the DMG metadata, but there probably isn’t any benefit in providing a languageName unless it’s required.

licenseButtons Are Optional

For several languages, including both US English and German, you don’t actually have to provide a licenseButtons file at all. For any language marked as having “predefined labels” in the list, those predefined labels will be used if you don’t provide your own.

1reaction
meydominiccommented, May 14, 2021

Many thanks @argv-minus-one , your solution works fine 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

No known languages found for specification English. #5 - GitHub
Hey, I am trying to build one of our projects but it fails with the following exception: ⨯ No known languages found for...
Read more >
Specification language - Wikipedia
A specification language is a formal language in computer science used during systems analysis, requirements analysis, and systems design to describe a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found