Skip to content

Latest commit

 

History

History
151 lines (104 loc) · 6.48 KB

License Specifications.md

File metadata and controls

151 lines (104 loc) · 6.48 KB

License Specifications

A license specification describes a license agreement to be attached to a disk image.

Disk image license agreements can be multilingual. A disk image can contain several license agreements, and macOS will show the one appropriate for the user's preferred language. Accordingly, a license specification can have more than one body, one for each language.

Here's the structure of a license specification. Click a property name to see more information about it.

{
	"$schema"?: "https://github.com/argv-minus-one/dmg-license/raw/master/schema.json" | "path/to/schema.json",

	"body": [
		{
			"lang": "language tag" | language code | ["language tag" | language code],
			"type"?: "plain" | "rtf",

			"text": "license text",
			// --- or ---
			"file": "path/to/file",
			"charset"?: "UTF-8" | "charset",
		}
	],

	"labels"?: [
		{
			"lang": "language tag" | language code | ["language tag" | language code],
			"languageName"?: "label text",
			"agree": "label text",
			"disagree": "label text",
			"print": "label text",
			"save": "label text",
			"message": "label text",
		}
	],

	"rawLabels"?: [
		{
			"lang": "language tag" | language code | ["language tag" | language code],
			"file": "path-to-file"
		}
	],

	"defaultLang"?: "language tag" | language code
}

body[n]

Text of the license agreement. Text can be given in two ways: inline, in the text property, or in a separate file, named by the file property.

body[n].type

Which format the text is in: either "plain" (plain text) or "rtf" (RTF).

Default is "plain", except when the file path (that is, the value of the file property) ends in .rtf, in which case the default is "rtf".

body[n].text

Text of the license agreement, specified directly in JSON.

Besides literal text, this can be base64 encoded. If it is, also specify "encoding": "base64", and give the character set in the charset property.

body[n].file

Path to the file containing the license text.

By default, the file is assumed to contain UTF-8 text with no binary encoding. To indicate otherwise, use the charset and/or [encoding] properties.

labels[n]

Localized labels for the buttons on the license agreement window. There are six: languageName (optional), agree, disagree, print, save, and message.

Some languages have a default set of labels that will be used if none are provided here, but for all other languages, a set of labels must be provided. Default label sets are available for:

  • en-US
  • fr-FR
  • en-GB
  • de-DE
  • it-IT
  • nl-NL
  • sv-SE
  • es-ES
  • da-DK
  • fr-CA
  • nb-NO
  • ja-JP
  • fi-FI
  • ko-KR
  • zh-CN
  • zh-TW
  • zh-Hans
  • zh-Hant
  • pt-BR

labels[n].languageName

Human-readable name of the language that this version of the license agreement is in, such as “English” or “Français”.

This is normally optional, but in some cases it's required, because the default language name isn't representable in the language's native character set. For example, the default language name of Vietnamese is “Tiếng Việt”, but that is not representable in the x-mac-vietnamese character set, so a languageName label is required for that language.

The list of supported languages notes which languages require a languageName label.

labels[n].agree, .disagree, .print, .save

Label text for the “Agree” button, “Disagree” button, “Print” button, and “Save” button, respectively.

labels[n].message

Brief instructions for the user.

For example, the English default message is: “If you agree with the terms of this license, press Agree to install the software. If you do not agree, press Disagree.”

rawLabels[n]

Localized labels for the buttons on the license agreement window, as with the labels property, but in raw format.

Instead of plain JSON strings, label sets provided this way are stored in binary files, whose contents (data fork) are copied into the disk image as a STR# resource with no parsing or character set conversion. They must be in the format that DiskImageMounter expects.

rawLabels[n].file

Path to the file containing the label strings.

lang

Which language(s) this body, labels, or rawLabels is in. Can be an IETF language tag like "en-US", a classic Mac OS language code like 0, or an array of language tags and/or language codes.

Only a certain set of language tags are recognized. See Supported Language Tags.md for the full list.

defaultLang

Selects which language should be the default, if there is no license localization for the user's preferred language.

If this property is omitted, the first lang of the first body is used as the default.

charset

An IANA character set name, as understood by the Core Foundation framework. Case insensitive.