argv-minus-one / dmg-license

Generate license agreements for macOS .dmg files
MIT License
19 stars 6 forks source link

No known languages found for specification English. #5

Closed meydominic closed 3 years ago

meydominic commented 3 years ago

Hey, I am trying to build one of our projects but 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 my workmates device.

What is the exact problem in this case?

Thanks and best regards, Dominic

argv-minus-one commented 3 years ago

Instead of English, you need to use an IETF language tag like en-US or a numeric Classic Mac OS language code like 0. There's a list of which language tags and codes are supported.

Please reopen this issue if you're still having trouble.

meydominic commented 3 years ago

Hey, thanks for your help, but I don't know, where to set this tag or something else. I forgot to mention, that we're using electron-builder to build our applications. electron-builder has dmg-license as dependency.

In the documentation of electron-builder is the following part:

To add license to DMG, create file license_LANG_CODE.txt in the build resources. Multiple license files in different languages are supported — use lang postfix (e.g. _de, _ru)). For example, create files license_de.txt and license_en.txt in the build resources. If OS language is german, license_de.txt will be displayed. See map of language code to name.

You can also change the default button labels of the DMG by passing a json file named licenseButtons_LANG_CODE.json. The german file would be named: licenseButtons_de.json. The contain file should have the following format:

https://www.electron.build/configuration/dmg

argv-minus-one commented 3 years ago

Oh, I see. I've never used electron-builder, but if they're using dmg-license, then their documentation appears to be incorrect.

Try naming your license file something like license_en-us.txt (plain text, US English) or license_de-de.rtf (RTF, German). Does that work?

meydominic commented 3 years ago

They switched to dmg-license some weeks ago and didn't update their documentation I think.

I'll test your recommendation and report back in a few minutes, thanks.

meydominic commented 3 years ago

updated the issue on electron-builder repository: https://github.com/electron-userland/electron-builder/issues/5834

argv-minus-one commented 3 years ago

Looks like everything's working now, so I'll go ahead and close this. Glad I could help!