모듈:Convert/text

-- https://ko.wikipedia.org/w/index.php?title=%EB%AA%A8%EB%93%88:Convert/text&oldid=33114619 에서 파생됨
-- This is a separate module to simplify translation for use on another wiki.
-- See [[:wikipedia:Template:Convert/Transwiki guide]] if copying to another wiki.

local translation_table = {
	omit_scale_sep = true,
	perunit_before_val = 2,
	currency_per_word  = '당',
	per_word = '매',
	plural_suffix = '',
	specials = {
		utype = {
			-- ["로컬 언어 유닛 종류"] = "이_스크립트에_사용된_이름"
			["연비"] = "type_fuel_efficiency",
			["길이"] = "type_length",
			["온도"] = "type_temperature",
			["부피"] = "type_volume",
			["fuel efficiency"] = "type_fuel_efficiency",
			["length"] = "type_length",
			["temperature"] = "type_temperature",
			["volume"] = "type_volume",
		},
		ucode = {
			exception = {
				-- ["로컬 언어 유닛 코드"] = "모듈_convert에_사용된_이름"
				["ft"] = "integer_more_precision",
				["in"] = "subunit_more_precision",
				["lb"] = "integer_more_precision",
			},
			istemperature = {
				-- Common temperature scales (not keVT or MK).
				-- ["unit code in local language"] = 1
				["C"] = true,
				["F"] = true,
				["K"] = true,
				["R"] = true,
			},
			usesymbol = {
				-- Use unit symbol not name if abbr not specified.
				-- ["unit code in local language"] = 1
				["C"] = 1,
				["F"] = 1,
				["K"] = 1,
				["R"] = 1,
				["C-change"] = 1,
				["F-change"] = 1,
				["K-change"] = 1,
			},
			alttype = {
				-- Unit has an alternate type that is a valid conversion.
				-- ["unit code in local language"] = "alternate type in local language"
				["Nm"] = "energy",
				["ftlb"] = "torque",
				["ftlb-f"] = "torque",
				["ftlbf"] = "torque",
				["inlb"] = "torque",
				["inlb-f"] = "torque",
				["inlbf"] = "torque",
				["inoz-f"] = "torque",
				["inozf"] = "torque",
			},
		},
	},
	mtext = {
		section_names = {
			-- name_used_in_this_script = 'Section title used in conversion data'
			overrides    = '재정의할 단위 코드 (Overrides)',
			conversions  = '환산표 (Conversions)',
			outmultiples = '복합 출력 단위 (Output multiples)',
			combinations = '단위 조합 (Combinations)',
			inmultiples  = '복합 입력 단위 (Input multiples)',
			defaults     = '기본 변환 단위 (Defaults)',
			links        = '링크 (Links)',
			perunits     = 'Automatic per units',
			varnames     = '변수명 (Variable names)',
		},
		titles = {
			-- name_used_in_this_script = 'Title of page'
			conversion_data = '모듈:Convert/설명문서/환산 데이터',
		},
		messages = {
			-- name_used_in_this_script = 'Error message ($1 = first parameter, $2 = second)'
			m_als_bad   = '"$1" 별칭에 잘못된 문자열이 있습니다.',
			m_als_dup   = '"$1" 별칭은 이미 정의되어 있습니다.',
			m_als_link  = 'Alias "$1" must include a wikilink ("[[...]]") in the symlink text.',
			m_als_mul   = 'Alias "$1" has multiplier "$2" which is not a number.',
			m_als_same  = '"$2" 별칭 코드에 같이 기재된 "$1"의 내용이 본래 단위와 동일합니다. "$2"의 내용에서 해당 기재사항을 제거해주세요.',
			m_als_type  = 'Target of alias "$1" has wrong type.',
			m_als_undef = '"=$1" 별칭을 쓰려면 본래 단위가 별칭보다 앞서 정의되었어야 합니다. 본래 단위가 정의된 이후에 해당 별칭을 정의해주세요.',
			m_cmb_miss  = 'Missing unit code for a combination.',
			m_cmb_none  = 'No units specified for combination "$1"',
			m_cmb_one   = 'Only one unit specified for combination "$1"',
			m_cmb_type  = 'Unit "$1" in combination "$2" has wrong type.',
			m_cmb_undef = 'Unit "$1" in combination "$2" not defined.',
			m_cmp_def   = 'Composite "$1" must specify a default unit code.',
			m_cmp_int   = 'Composite "$1" has components where scale ratios are not integers.',
			m_cmp_inval = 'Composite "$1" has a component with an invalid scale, "$2".',
			m_cmp_many  = 'Composite "$1" has too many fields.',
			m_cmp_miss  = 'Missing unit code for a composite.',
			m_cmp_order = 'Composite "$1" has components in wrong order or with invalid scales.',
			m_cmp_scale = 'Alternate unit "$1" in composite "$2" has wrong scale.',
			m_cmp_two   = 'Composite "$1" must specify exactly two unit codes.',
			m_cmp_type  = 'Unit "$1" in composite "$2" has wrong type.',
			m_cmp_undef = 'Unit "$1" in composite "$2" not defined.',
			m_def_cond  = 'Invalid condition in default "$1" for unit "$2".',
			m_def_fmt   = 'Default output "$1" for unit "$2" should have 2 or 3 "!".',
			m_def_rpt   = 'Default output "$1" for unit "$2" is repeated.',
			m_def_same  = 'Default output for unit "$1" is the same unit.',
			m_def_type  = 'Default output "$1" for unit "$2" has wrong type.',
			m_def_undef = '"$2"의 기본 변환 단위로 기재된 "$1" 단위 코드를 환산표에서 찾을 수 없었습니다. "$1" 단위가 제대로 정의된 것인지, 단위 코드를 오타낸 것이 아닌지 확인해주세요.',
			m_dfs_code  = 'Defaults section: no unit code specified.',
			m_dfs_dup   = 'Defaults section: unit "$1" has already been specified.',
			m_dfs_none  = 'Defaults section: unit "$1" has no default specified.',
			m_dfs_sym   = 'Defaults section: unit "$1" must have a symbol.',
			m_dfs_two   = 'Defaults section: unit "$1" should have two fields only.',
			m_dfs_undef = 'Defaults section: unit "$1" is not defined.',
			m_dup_code  = 'Unit code "$1" has already been defined.',
			m_error     = '오류:',
			m_ftl_read  = '"[[$1]]" 문서에서 위키문법을 읽지 못했습니다. 해당 문서가 정말로 존재하는지, 존재한다면 문서명에 오타가 있는지 확인하세요.',
			m_ftl_table = '[[$1]] should export table "$2".',
			m_ftl_type  = 'Fatal error: unknown data type for "$1"',
			m_hdg_lev2  = '"$1" 단락의 시작 부분에 위치해야 할 2단계 제목(== $1 ==)을 찾을 수 없었습니다. 문서에 옆의 제목을 넣어주세요.',
			m_hdg_lev3  = '$1 앞에 3단계 제목(===)이 없습니다.',
			m_line_num  = ' ($1번째 줄).',
			m_lnk_brack = 'Link "$1" has wrong number of brackets.',
			m_lnk_dup   = 'Link exception "$1" is already defined.',
			m_lnk_miss  = 'Missing unit code for a link.',
			m_lnk_none  = 'No link defined for unit "$1".',
			m_lnk_sym   = 'Unit code "$1" for a link must have a symbol.',
			m_lnk_two   = 'Row for unit "$1" link should have two fields only.',
			m_lnk_type  = 'Link exception "$1" has wrong type.',
			m_lnk_undef = 'Unit code "$1" for a link is not defined.',
			m_miss_code = 'Missing unit code.',
			m_miss_sym  = 'Missing symbol.',
			m_miss_type = 'Missing unit type.',
			m_mul_int   = 'Multiple "$1" has components where scale ratios are not integers.',
			m_mul_miss  = 'Missing unit code for a multiple.',
			m_mul_none  = 'No units specified for multiple "$1"',
			m_mul_one   = 'Only one unit specified for multiple "$1"',
			m_mul_order = 'Multiple "$1" has components in wrong order or with invalid scales.',
			m_mul_scale = 'Multiple "$1" has a component with an invalid scale, "$2".',
			m_mul_std   = 'Unit "$1" in multiple "$2" must be a standard unit.',
			m_mul_type  = 'Unit "$1" in multiple "$2" has wrong type.',
			m_mul_undef = 'Unit "$1" in multiple "$2" not defined.',
			m_no_title  = 'Need title of page with unit definitions.',
			m_ovr_dup   = 'Override "$1" is already defined.',
			m_ovr_miss  = 'Missing unit code for an override.',
			m_per_dup   = 'Per unit "$1" already defined.',
			m_per_empty = 'Unit "$1" has an empty field in the "per".',
			m_per_fuel  = 'Unit "$1" has invalid unit types for fuel efficiency.',
			m_per_inv   = 'Invalid field for a "per".',
			m_per_two   = 'Unit "$1" does not have exactly 2 fields in the "per".',
			m_per_undef = 'Unit "$1" has undefined unit code "$2" in the "per".',
			m_percent_s = 'Field "$1" must not contain "%s".',
			m_pfx_bad   = 'Unknown prefix: "$1".',
			m_pfx_name  = 'Unit with Prefix set must include Name.',
			m_scl_bad   = 'Scale expression is invalid: "$1".',
			m_scl_miss  = 'Missing scale.',
			m_scl_oflow = 'Scale expression gives an invalid value: "$1".',
			m_var_cnt   = 'Variable names section: each row must have five fields.',
			m_var_dup   = 'Unit "$1" already has a variable name.',
			m_var_miss  = 'Missing field for a variable name.',
			m_var_undef = 'Unit "$1" in variable names is not defined.',
			m_warning   = '경고:',
			m_wrn_more  = '  (이외에도 내용이 더 있지만 생략함)',
			m_wrn_nbsp  = 'Line $1 contains a nonbreaking space.',
			m_wrn_nodef = 'Units with the following unit codes have no default output.',
			m_wrn_ucode = '  $1',
		},
	},
}

-- 몇몇 단위들은 킬로그램의 "kg"처럼 단위 코드를 사용하기 전에 SI 접두사가 붙습니다.
local SIprefixes = {
	-- The prefix field is what the prefix should be, if different from the prefix used.
	['Y'] = { exponent = 24, name = '요타',                   },
	['Z'] = { exponent = 21, name = '제타',                   },
	['E'] = { exponent = 18, name = '엑사'  ,                 },
	['P'] = { exponent = 15, name = '페타' ,                  },
	['T'] = { exponent = 12, name = '테라' ,                  },
	['G'] = { exponent =  9, name = '기가' ,                  },
	['M'] = { exponent =  6, name = '메가' ,                  },
	['k'] = { exponent =  3, name = '킬로' ,                  },
	['h'] = { exponent =  2, name = '헥토',                   },
	['da']= { exponent =  1, name = '데카',                   },
	['d'] = { exponent = -1, name = '데시' ,                  },
	['c'] = { exponent = -2, name = '센티',                   },
	['m'] = { exponent = -3, name = '밀리',                   },
	['μ'] = { exponent = -6, name = '마이크로', prefix = 'µ'  },  -- key = 'GREEK SMALL LETTER MU' (U+03BC) utf-8 CE BC
	['µ'] = { exponent = -6, name = '마이크로',               },  -- key = 'MICRO SIGN' (U+00B5) utf-8 C2 B5
	['u'] = { exponent = -6, name = '마이크로', prefix = 'µ'  },  -- not an SI prefix, but allow for people typing this
	['n'] = { exponent = -9, name = '나노' ,                  },
	['p'] = { exponent =-12, name = '피코' ,                  },
	['f'] = { exponent =-15, name = '펨토',                   },
	['a'] = { exponent =-18, name = '아토' ,                  },
	['z'] = { exponent =-21, name = '젭토',                   },
	['y'] = { exponent =-24, name = '욕토',                   },
}

-- Some units can be qualified with one of the following prefixes, when linked.
local customary_units = {                   -- !! LOCALIZED !!
	{ "미국", link = "미국 단위계" },		-- 1
	{ "US", link = "미국 단위계" },			-- 2
	{ "U.S.", link = "미국 단위계" },		-- 3
	{ "영국", link = "야드파운드법" },		-- 4
	{ "imp", link = "야드파운드법" },		-- 5
}

-- Names when using engineering notation (a prefix of "eN" where N is a number; example "e6km").
-- key = { "name", link = "article title", exponent = numeric_key_value }
-- If lk=on and link is defined, the name of the number will appear as a link.
local eng_scales = {
	["3"]  = { "천", exponent = 3 },
	["4"]  = { "만", exponent = 4 },
	["6"]  = { "백만", exponent = 6 },
	["8"]  = { "억", exponent = 8 },
	["9"]  = { "십억", link = "1000000000", exponent = 9 },
	["12"] = { "조", link = "1000000000000", exponent = 12 },
	["15"] = { "천조", link = "1000000000000000", exponent = 15 },
	["16"] = { "경", link = "10000000000000000", exponent = 16 },
	["20"] = { "해", link = "100000000000000000000", exponent = 20 },
	["24"] = { "자", link = "1000000000000000000000000", exponent = 24 },
}

-- One of the following categories is included in the text of each message.
local all_categories = {
	unit = "[[분류:단위 변환 시 올바르지 않은 단위를 사용한 문서]]",
	option = "[[분류:단위 변환 시 올바르지 않은 옵션을 사용한 문서]]",
}

-- For some error messages, the following puts the wanted style around
-- each unit code marked like '...%{ft%}...'.
local unitcode_regex = '%%([{}])'
local unitcode_replace = { ['{'] = '"', ['}'] = '"' }  -- no longer need the more elaborate substitute used before 2013-09-28

-- All messages that may be displayed if a problem occurs.
local all_messages = {
	-- Message format string, %s parameters: anchor, title, text, category.
	-- Each displayed message starts with "Convert:" so can easily locate by searching article.
	cvt_format = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i>[[:wikipedia:Help:Convert messages#%s|<span title="단위 변환: %s">단위 변환: %s</span>]]</i>]</sup>%s',
	cvt_format2 = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[[:wikipedia:Help:Convert messages#%s|<span title="단위 변환: %s">%s</span>]]</sup>%s',
	-- Each of following messages is a table:
	-- { [1] = 'title',         -- mouseover title text
	--   [2] = 'text',          -- link text displayed in article
	--   [3] = 'category key',  -- key to lookup category in all_categories
	--   [4] = 'anchor',        -- anchor for link to relevant section on help page
	--   regex = gsub_regex,
	--   replace = gsub_table,
	-- }                    Mouseover title text                           Link text               CatKey     Anchor
	cvt_bad_num        = { '"%s" 값은 반드시 숫자여야 합니다'           , '올바르지 않은 숫자'  , 'option',  '올바르지_않은_숫자'   },
	cvt_big_prec       = { 'Precision "%s" is too large'                , 'precision too large' , 'option',  'precision_too_large'  },
	cvt_invalid_num    = { '숫자가 너무 커서 한계 범위를 넘어갔습니다'  , '한계범위를 넘은 숫자', 'option',  '한계범위를_넘은_숫자' },
	cvt_no_num         = { 'Needs the number to be converted'           , 'needs a number'      , 'option',  'needs_number'         },
	cvt_no_num2        = { 'Needs another number for a range'           , 'needs another number', 'option',  'needs_another_number' },
	cvt_bad_frac       = { 'frac "%s" must be an integer above 1'       , 'invalid fraction'    , 'option',  'invalid_fraction'     },
	cvt_bad_prec       = { 'Precision "%s" must be an integer'          , 'invalid precision'   , 'option',  'invalid_precision'    },
	cvt_bad_sigfig     = { 'sigfig "%s" must be a positive integer'     , 'invalid sigfig'      , 'option',  'invalid_sigfig'       },
	cvt_empty_option   = { '비어있던 "%s" 옵션이 있어 무시했습니다'     , '빈 옵션'             , 'option',  '빈_옵션'              },
	cvt_deprecated     = { '"%s" 옵션은 폐지될 예정입니다.'             , '*'                   , 'option',  '폐지될_옵션', format = 'cvt_format2' },
	cvt_no_spell       = { 'Spelling is not available'                  ,'버그네요, 제보해주세요','option',  '도움_요청하기'        },
	cvt_unknown_option = { '올바르지 않은 "%s" 옵션이 있어 무시했습니다', '올바르지 않은 옵션'  , 'option',  '올바르지_않은_옵션'   },
	cvt_bad_default    = { '"%s" 단위가 올바르지 않은 기본 변환 단위를 가지고 있습니다', '버그네요, 제보해주세요', 'unit', '도움_요청하기'},
	cvt_bad_unit       = { 'Unit "%s" is invalid here'                  , 'unit invalid here'   , 'unit'  ,  'unit_invalid_here'    },
	cvt_no_default     = { '"%s" 단위에 기본 변환 단위가 없습니다'      ,'버그네요, 제보해주세요','unit'  ,  '도움_요청하기'        },
	cvt_no_unit        = { 'Needs name of unit'                         , 'needs unit name'     , 'unit'  ,  'needs_unit_name'      },
	cvt_unknown        = { '"%s" 단위는 모르는 단위입니다'              , '모르는 단위'         , 'unit'  ,  '모르는_단위'          },
	cvt_should_be      = { '%s'                                         , '모호한 단위'         , 'unit'  ,  '모호한_단위', regex = unitcode_regex, replace = unitcode_replace },
	cvt_mismatch       = { '"%s" 종류의 단위를 "%s" 종류의 단위로 바꿀 수 없습니다', '변환할 수 없는 단위 종류로 변환 시도', 'unit', '변환할_수_없는_단위_종류로_변환_시도'},
	cvt_bug_convert    = { '버그: Cannot convert between specified units','버그네요, 제보해주세요','unit'  ,  '도움_요청하기'        },
	cvt_lookup         = { '"%s" 단위가 부정확하게 정의되었습니다'      ,'버그네요, 제보해주세요','unit'  ,  '도움_요청하기'        },
}

-- Text to join input value/unit with output value/unit.
local disp_joins = {
	-- [1]=출력 값 앞, [2]=출력 값 뒤, [3]=조합 단위 출력 값 사이; 기본값은"; "
	-- [wantname] gives default abbr=off
	["or"]         = { " or "    , "" , " or ", wantname = true },
	["sqbr-sp"]    = { " ["      , "]" },
	["sqbr-nbsp"]  = { "&nbsp;[" , "]" },
	["comma"]      = { ", "      , "" , ", " },
	["콤마"]       = { ", "      , "" , ", " },
	["쉼표"]       = { ", "      , "" , ", " },
	["반점"]       = { ", "      , "" , ", " },
	["slash-sp"]   = { " / "     , "" , wantname = true },
	["slash-nbsp"] = { "&nbsp;/ ", "" , wantname = true },
	["slash-nosp"] = { "/"       , "" , wantname = true },
	["b"]          = { " ("      , ")" },
	["(or)"]       = { " ("      , ")", " or " },
	["br"]         = { "<br />"  , "" , wantname = true },
	["br()"]       = { "<br />(" , ")", wantname = true },
}

-- Text to separate values in a range.
local range_types = {
	-- Specifying a table requires either:
	-- * "off" and "on" values (for "abbr=off" and "abbr=on"), or
	-- * "input" and "output" values (for LHS and RHS);
	-- other fields are optional.
	-- When "adj=on|abbr=off" applies, spaces in range text are replaced with hyphens.
	-- With "exception = true", that also occurs with "adj=on|abbr=on".
	-- If "adj" is defined here, that text (unchanged) is used with "adj=on".
	["+"]      = " + ",
	[","]      = ",&nbsp;",
	[", and"]  = ", and ",
	[", 그리고"] = ", 그리고",
	["와"]     = "와 ",
	["과"]     = "과 ",
	[", or"]   = ", or ",
	[", 또는"] = ", 또는 ",
	["by"]     = " by ",
	["-"]      = "–",
	["~"]      = " ~ ",
	["to about"] = " to about",
	["and"]    = { off = " and ", on = " and ", exception = true },
	["그리고"]    = { off = " 그리고 ", on = " 그리고 ", exception = true },
	["과"]    = { off = "과 ", on = "과 ", exception = true },
	["와"]     = { off = "와 ", on = "와 ", exception = true },
	["and(-)"] = { input = " and ", output = "–" },
	["그리고(~)"] = { input = " 그리고 ", output = "~" },
	["그리고(-)"] = { input = " 그리고 ", output = "-" }, 
	["과(~)"]  = { input = "과 ", output = " ~ " }, 
	["과(-)"] = { input = "과 ", output = "-" }, 
	["와(~)"]  = { input = "와 ", output = " ~ " }, 
	["와(-)"] = { input = "와 ", output = "-" }, 
	["or"]     = { off = " or " , on = " or " , exception = true },
	["또는"]   = { off = " 또는 ", on = " 또는 ", exception = true},
	["to"]     = { off = " to " , on = " to " , exception = true },
	["to(-)"]  = { input = "&nbsp;to ", output = "–" },
	["+/-"]    = { off = "&nbsp;±&nbsp;", on = "&nbsp;±&nbsp;", adj = "&nbsp;±&nbsp;", is_range_change = true },
	["by(x)"]  = { input = " by ", output = " ×&nbsp;", out_range_x = true },
	["x"]      = { off = " by ", on = " ×&nbsp;", abbr_range_x = true },
	["X"]      = { off = " by ", on = " ×&nbsp;" },  -- TEMPORARY and undocumented option for experiments to compare with new abbr_range_x
	["xx"]     = "&nbsp;×&nbsp;",
	["*"]      = "×",  -- use "*" to replace "x" in {{convert/2}} which is different from "x" in old {{convert}}
}

local range_aliases = {
	-- ["alternative name for a range"] = "standard range name"
	["&"]        = "그리고",
	["–"]        = "-",
	["~"]        = " ~ ",
	["&ndash;"]  = "-",
	["to-"]      = "to(-)",
	["×"]        = "x",
	["&times;"]  = "x",
	["곱"]       = "x",
	["±"]        = "+/-",
	["플마"]     = "+/-",
	["&plusmn;"] = "+/-",
}

-- Convert accepts range text delimited with whitespace, for example, {{convert|1 to 2|ft}}.
-- In addition, the following "words" are accepted without spaces, for example, {{convert|1-2|ft}}.
-- Words must be in correct order for searching, for example, 'x' after 'xx'.
local range_words = { '-', '–', 'xx', 'x', '*' }

local ranges = {
	types = range_types,
	aliases = range_aliases,
	words = range_words,
}

-- Valid option names.
local en_option_name = {
	-- ["local text for option name"] = "en name used in this module"
	["$"] = "$",
	["abbr"] = "abbr",
	["adj"] = "adj",
	["comma"] = "comma",
	["디버그"] = "debug",
	["debug"] = "debug",
	["disp"] = "disp",
	["frac"] = "frac",
	["lang"] = "lang",
	["링크"] = "lk",
	["lk"] = "lk",
	["near"] = "near",
	["order"] = "order",
	["round"] = "round",
	["sigfig"] = "sigfig",
	["sing"] = "adj",                   -- "sing" is an old alias for "adj"
	["sortable"] = "sortable",
	["sp"] = "sp",
	["spell"] = "spell",
	["stylein"] = "stylein",
	["styleout"] = "styleout",
}

-- Valid option values.
-- Convention: parms.opt_xxx refers to an option that is set here
-- (not intended to be set by the template which invokes this module).
-- Example: At en.wiki, "abbr" includes:
--     ["comma"] = "opt_nocomma"
-- As a result, if the template uses abbr=comma, this script sets:
--     parms["opt_nocomma"] = true
--     parms["abbr"] = nil
-- Therefore parms.abbr will be nil, or will have one of the listed values
-- that do not start with "opt_".
-- An option value of form "xxx?" is the same as "xxx" but shows the input as deprecated.
local en_option_value = {
	-- $=x is handled as a special case: x should be a currency symbol that will be used instead of "$"
	["abbr"] = {
		-- ["local text for option value"] = "en value used in this module"
		["comma"] = "opt_nocomma?",     -- no numsep in input or output numbers
		["def"] = "",                   -- ignored (some wrapper templates call convert with "abbr=def" to mean "default abbreviation")
		["h"] = "on",                   -- abbr=on + use "h" for hand unit (default)
		["hh"] = "opt_hand_hh",         -- abbr=on + use "hh" for hand unit
		["in"] = "in",                  -- use symbol for LHS unit
		["mos"] = "mos",                -- in a range, repeat the input unit (no longer used)
		["none"] = "off",               -- old name for "off"
		["off"] = "off",                -- use name for all units
		["on"] = "on",                  -- use symbol for all units
		["out"] = "out",                -- use symbol for RHS unit (default)
		["values"] = "opt_values",      -- show only input and output numbers, not units
		["~"] = "opt_also_symbol",      -- show input unit symbol as well as name
	},
	["adj"] = {
		["1"] = "opt_singular",         -- unit name is singular when value satisfies: (-1 <= v and v < 0) or (0 < v and v <= 1)
		["flip"] = "opt_flip?",         -- reverse order of input/output
		["j"] = "opt_use_nbsp",         -- "join": use "&nbsp;" instead of " " between value and unit name
		["mid"] = "opt_adjectival, opt_adj_mid",  -- adj=on with user-specified text after input unit (between input and output)
		["nocomma"] = "opt_nocomma?",   -- no numsep in input or output numbers
		["off"] = "",                   -- ignored (off is the default)
		["on"] = "opt_adjectival",      -- unit name is singular and hyphenated
		["pre"] = "opt_one_preunit",    -- user-specified text before input unit
		["ri0"] = "opt_ri=0",           -- round input with precision = 0
		["ri1"] = "opt_ri=1",           -- round input with precision = 1
		["ri2"] = "opt_ri=2",           -- round input with precision = 2
		["ri3"] = "opt_ri=3",           -- round input with precision = 3
	},
	["comma"] = {
		["5"] = "opt_comma5",           -- only use numsep grouping if 5 or more digits
		["gaps"] = "opt_gaps",          -- use gaps, not numsep, to separate groups of digits
		["gaps3"] = "opt_gaps, opt_gaps3",  -- group only in threes rather than default of no gap before a single digit after decimal mark
		["gaps5"] = "opt_gaps?",        -- deprecated 2015-05-29, was: opt_gaps + opt_comma5
		["off"] = "opt_nocomma",        -- no numsep in input or output numbers
	},
	["debug"] = {
		["yes"] = "opt_sortable_debug", -- make the normally hidden sort key visible
	},
	["disp"] = {
		["/"] = "or?",                  -- see "slash"
		["2"] = "opt_output_only?",     -- display only output value and symbol/name (not input)
		["5"] = "opt_round=5",          -- round output value to nearest 5
		["b"] = "b",                    -- join: '(...)'
		["(or)"] = "(or)",              -- join: '(...)' with 'or' between outputs in a combination
		["br"] = "br",                  -- join: '<br />'
		["br()"] = "br()",              -- join: '<br />(...)'
		["comma"] = "comma",            -- join: ','
		["flip"] = "opt_flip",          -- reverse order of input/output
		["flip5"] = "opt_flip, opt_round=5?",  -- disp=flip + disp=5
		["nocomma"] = "opt_nocomma?",   -- no numsep in input or output numbers
		["number"] = "opt_output_number_only",  -- display output value (not input, and not output symbol/name)
		["or"] = "or",                  -- join: 'or'
		["out"] = "opt_output_only",
		["output number only"] = "opt_output_number_only",
		["output only"] = "opt_output_only",
		["preunit"] = "opt_two_preunits",    -- user-specified text before input and output units
		["s"] = "or?",                  -- see "slash"
		["slash"] = "or?",              -- 2014-11-03: "disp=slash" is now equivalent to "disp=or" as slash is unhelpful
		["sqbr"] = "sqbr",              -- join: '[...]'
		["table"] = "opt_table",        -- output is suitable for a table cell with align="right"
		["tablecen"] = "opt_tablecen",  -- output is suitable for a table cell with align="center"
		["u2"] = "opt_output_unit_only?", -- display output symbol/name (not input, and not output value)
		["unit"] = "opt_input_unit_only", -- display input symbol/name (not output, and not input value)
		["unit or text"] = "opt_input_unit_only, opt_ignore_error", -- display input symbol/name, or given unit code if not known
		["unit2"] = "opt_output_unit_only",
		["x"] = "x",                    -- join: <first>...<second> (user-specified text)
	},
	-- frac=x is handled as a special case: x must be an integer (possibly in local language) = 2 or more
	["lang"] = {                        -- language for output digits (both en and local digits are always accepted for input)
		["en"] = "opt_lang_en",         -- use en digits for numbers, regardless of local language
		["local"] = "opt_lang_local",   -- use local digits for numbers (default, although config can change default to en)
	},
	["lk"] = {
		["입력"] = "in",                  -- link LHS unit name or symbol
		["해제"] = "off",                -- 링크를 걸지 않음: same as default except for hand unit
		["모두"] = "on",                  -- link all unit names or symbols (but not twice for the same unit)
		["출력"] = "out",                -- link RHS unit name or symbol
		["in"] = "in",                  -- link LHS unit name or symbol
		["off"] = "off",                -- do not link: same as default except for hand unit
		["on"] = "on",                  -- link all unit names or symbols (but not twice for the same unit)
		["out"] = "out",                -- link RHS unit name or symbol
	},
	["near"] = {
		["5"] = "opt_round=5?",         -- round output value to nearest 5
	},
	["order"] = {
		["flip"] = "opt_flip",          -- reverse order of input/output
	},
	["round"] = {
		["0.5"] = "opt_round=0.5",      -- round output value to nearest 0.5
		["5"] = "opt_round=5",          -- round output value to nearest 5
		["10"] = "opt_round=10",        -- round output value to nearest 10 (same as but clearer than "|-1")
		["25"] = "opt_round=25",        -- round output value to nearest 25
		["50"] = "opt_round=50",        -- round output value to nearest 50
		["each"] = "opt_round_each",    -- using default precision in a range, round each output separately (default uses highest precision of each item in range)
	},
	-- sigfig=x is handled as a special case: x must be an integer (possibly in local language) = 1 or more
	["sortable"] = {
		["off"] = "",                   -- ignored (off is the default)
		["in"] = "opt_sortable_on?",    -- same as "on"
		["on"] = "opt_sortable_on",     -- output sort key for use in a sortable table, based on value from converting to a standard base unit
		["out"] = "opt_sortable_on?",   -- same as "on"
	},
	["sp"] = {
		["us"] = "opt_sp_us",           -- use U.S. spelling (like "meter" instead of default "metre")
	},
	["spell"] = {                       -- only English spelling is supported; not scientific notation; only some fractions
		["in"] = "opt_spell_in",        -- spell input value in words
		["In"] = "opt_spell_in, opt_spell_upper",                -- spell input value in words with first letter uppercase
		["on"] = "opt_spell_in, opt_spell_out",                  -- spell input and output values in words
		["On"] = "opt_spell_in, opt_spell_out, opt_spell_upper", -- same, with first letter of first word in result uppercase
	},
	-- stylein=x is handled as a special case: x can be any text
	-- styleout=x is handled as a special case: x can be any text
}

return {
	SIprefixes = SIprefixes,
	all_categories = all_categories,
	all_messages = all_messages,
	currency = { ['$'] = true, ['£'] = true, ['₩'] = true, ['¥'] = true, ['원'] = true, ['엔'] = true, ['위안'] = true, ['달러'] = true, ['파운드'] = true },
	currency_strings = { ['원'] = '₩', ['엔'] = '¥', ['위안'] = '¥', ['달러'] = '$', ['파운드'] = '£' },  -- for kowiki
	customary_units = customary_units,
	disp_joins = disp_joins,
	en_option_name = en_option_name,
	en_option_value = en_option_value,
	eng_scales = eng_scales,
	ranges = ranges,
	translation_table = translation_table,
}