feat(skd-compile): многоязычный title/presentation (объектная форма)

Везде, где DSL принимает title/presentation, теперь поддерживается
объектная форма с языками: "title": { "ru": "...", "en": "..." }.
Строка по-прежнему работает как ru-only.

Покрыто: field title, calculatedField title, parameter title/presentation,
settingsVariant title/presentation (root и в structure-items),
availableValue title/presentation, userSettingPresentation в filter/dataParameter,
mltext-значения в conditionalAppearance.appearance (ключи Текст/Заголовок/Формат).

Реализация:
- Хелпер emit_mltext / Emit-MLText расширен — принимает string|dict и
  итерирует по языкам.
- 8 inline-блоков LocalStringType в каждом скрипте заменены на вызовы
  хелпера (унификация — побочный эффект, бенефит на будущее).
- На входе сняты str()/"$()" коэрции для title/presentation, чтобы dict
  доходил до хелпера живым.

- SKILL.md: одна строка про объектную форму title.
- tests: новый snapshot-кейс multi-lang-title (5 узлов с ru+en).
- Версия v1.21.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-04-25 18:30:37 +03:00
parent 1a5b788305
commit 576f6dda8a
5 changed files with 196 additions and 122 deletions
+2
View File
@@ -86,6 +86,8 @@ powershell.exe -NoProfile -File .claude/skills/skd-compile/scripts/skd-compile.p
```
`dataPath` автоматически берётся из `field`, если не указан явно.
Многоязычный заголовок: `"title": { "ru": "...", "en": "..." }`. Применимо везде, где принимается title/presentation (поля, calculatedFields, parameters, settingsVariants, availableValues и пр.). Строка эквивалентна `{ "ru": "..." }`.
Типы: `string`, `string(N)`, `decimal(D,F)`, `boolean`, `date`, `dateTime`, `CatalogRef.X`, `DocumentRef.X`, `EnumRef.X`, `StandardPeriod`. Ссылочные типы эмитируются с inline namespace `d5p1:` (`http://v8.1c.ru/8.1/data/enterprise/current-config`). Сборка EPF со ссылочными типами требует базу с соответствующей конфигурацией.
Составной тип (несколько типов значений) — массив в объектной форме: `"type": ["CatalogRef.A", "CatalogRef.B"]`. Квалификаторы (`(N)`, `(D,F)`) применяются к каждому элементу.
@@ -1,4 +1,4 @@
# skd-compile v1.20 — Compile 1C DCS from JSON
# skd-compile v1.21 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$DefinitionFile,
@@ -80,12 +80,25 @@ function Resolve-QueryValue {
}
function Emit-MLText {
param([string]$tag, [string]$text, [string]$indent)
param([string]$tag, $text, [string]$indent)
X "$indent<$tag xsi:type=`"v8:LocalStringType`">"
X "$indent`t<v8:item>"
X "$indent`t`t<v8:lang>ru</v8:lang>"
X "$indent`t`t<v8:content>$(Esc-Xml $text)</v8:content>"
X "$indent`t</v8:item>"
# Multi-lang: object form { ru: "...", en: "..." } → one <v8:item> per language
if ($text -is [System.Management.Automation.PSCustomObject] -or $text -is [hashtable] -or $text -is [System.Collections.IDictionary]) {
$props = if ($text -is [System.Management.Automation.PSCustomObject]) { $text.PSObject.Properties } else { $text.GetEnumerator() | ForEach-Object { @{ Name = $_.Key; Value = $_.Value } } }
foreach ($p in $props) {
$lang = if ($p -is [hashtable]) { $p.Name } else { $p.Name }
$content = if ($p -is [hashtable]) { $p.Value } else { $p.Value }
X "$indent`t<v8:item>"
X "$indent`t`t<v8:lang>$(Esc-Xml "$lang")</v8:lang>"
X "$indent`t`t<v8:content>$(Esc-Xml "$content")</v8:content>"
X "$indent`t</v8:item>"
}
} else {
X "$indent`t<v8:item>"
X "$indent`t`t<v8:lang>ru</v8:lang>"
X "$indent`t`t<v8:content>$(Esc-Xml "$text")</v8:content>"
X "$indent`t</v8:item>"
}
X "$indent</$tag>"
}
@@ -610,7 +623,7 @@ function Emit-Field {
$f = @{
dataPath = if ($fieldDef.dataPath) { "$($fieldDef.dataPath)" } elseif ($fieldDef.field) { "$($fieldDef.field)" } else { "" }
field = if ($fieldDef.field) { "$($fieldDef.field)" } else { "$($fieldDef.dataPath)" }
title = if ($fieldDef.title) { "$($fieldDef.title)" } else { "" }
title = if ($fieldDef.title) { $fieldDef.title } else { "" }
type = if ($fieldDef.type) {
if ($fieldDef.type -is [array] -or $fieldDef.type -is [System.Collections.IList]) {
@($fieldDef.type | ForEach-Object { Resolve-TypeStr "$_" })
@@ -845,7 +858,7 @@ function Emit-CalcFields {
$parsed = Parse-CalcShorthand $cf
$dataPath = "$($parsed.dataPath)"
$expression = "$($parsed.expression)"
$title = "$($parsed.title)"
$title = $parsed.title
$typeStr = "$($parsed.type)"
if ($parsed.restrict) { $restrictTokens = @($parsed.restrict) }
} else {
@@ -853,7 +866,7 @@ function Emit-CalcFields {
elseif ($cf.field) { "$($cf.field)" }
else { "$($cf.name)" }
$expression = "$($cf.expression)"
if ($cf.title) { $title = "$($cf.title)" }
if ($cf.title) { $title = $cf.title }
if ($cf.type) { $typeStr = Resolve-TypeStr "$($cf.type)" }
$restrictVal = if ($cf.restrict) { $cf.restrict } elseif ($cf.useRestriction) { $cf.useRestriction } else { $null }
@@ -955,11 +968,11 @@ function Emit-SingleParam {
# a synonym — 1C UI labels a parameter's caption "Представление").
$title = ""
if ($parsed.title) {
$title = "$($parsed.title)"
$title = $parsed.title
} elseif ($p -isnot [string] -and $p.title) {
$title = "$($p.title)"
$title = $p.title
} elseif ($p -isnot [string] -and $p.presentation) {
$title = "$($p.presentation)"
$title = $p.presentation
}
if ($title) {
Emit-MLText -tag "title" -text $title -indent "`t`t"
@@ -1012,14 +1025,9 @@ function Emit-SingleParam {
X "`t`t<availableValue>"
X "`t`t`t<value xsi:type=`"$avType`">$(Esc-Xml $avVal)</value>"
# `title` accepted as synonym of `presentation` — both map to the same UI label.
$avPres = if ($av.presentation) { "$($av.presentation)" } elseif ($av.title) { "$($av.title)" } else { "" }
$avPres = if ($av.presentation) { $av.presentation } elseif ($av.title) { $av.title } else { "" }
if ($avPres) {
X "`t`t`t<presentation xsi:type=`"v8:LocalStringType`">"
X "`t`t`t`t<v8:item>"
X "`t`t`t`t`t<v8:lang>ru</v8:lang>"
X "`t`t`t`t`t<v8:content>$(Esc-Xml $avPres)</v8:content>"
X "`t`t`t`t</v8:item>"
X "`t`t`t</presentation>"
Emit-MLText -tag "presentation" -text $avPres -indent "`t`t`t"
}
X "`t`t</availableValue>"
}
@@ -1413,12 +1421,7 @@ function Emit-AreaTemplateDSL {
} else {
# Static text
X "`t`t`t`t`t<dcsat:item xsi:type=`"dcsat:Field`">"
X "`t`t`t`t`t`t<dcsat:value xsi:type=`"v8:LocalStringType`">"
X "`t`t`t`t`t`t`t<v8:item>"
X "`t`t`t`t`t`t`t`t<v8:lang>ru</v8:lang>"
X "`t`t`t`t`t`t`t`t<v8:content>$(Esc-Xml $cellStr)</v8:content>"
X "`t`t`t`t`t`t`t</v8:item>"
X "`t`t`t`t`t`t</dcsat:value>"
Emit-MLText -tag "dcsat:value" -text $cellStr -indent "`t`t`t`t`t`t"
X "`t`t`t`t`t</dcsat:item>"
}
}
@@ -1635,12 +1638,7 @@ function Emit-FilterItem {
}
if ($item.presentation) {
X "$indent`t<dcsset:presentation xsi:type=`"v8:LocalStringType`">"
X "$indent`t`t<v8:item>"
X "$indent`t`t`t<v8:lang>ru</v8:lang>"
X "$indent`t`t`t<v8:content>$(Esc-Xml "$($item.presentation)")</v8:content>"
X "$indent`t`t</v8:item>"
X "$indent`t</dcsset:presentation>"
Emit-MLText -tag "dcsset:presentation" -text $item.presentation -indent "$indent`t"
}
if ($item.viewMode) {
@@ -1653,12 +1651,7 @@ function Emit-FilterItem {
}
if ($item.userSettingPresentation) {
X "$indent`t<dcsset:userSettingPresentation xsi:type=`"v8:LocalStringType`">"
X "$indent`t`t<v8:item>"
X "$indent`t`t`t<v8:lang>ru</v8:lang>"
X "$indent`t`t`t<v8:content>$(Esc-Xml "$($item.userSettingPresentation)")</v8:content>"
X "$indent`t`t</v8:item>"
X "$indent`t</dcsset:userSettingPresentation>"
Emit-MLText -tag "dcsset:userSettingPresentation" -text $item.userSettingPresentation -indent "$indent`t"
}
X "$indent</dcsset:item>"
@@ -1747,12 +1740,7 @@ function Emit-AppearanceValue {
} elseif ($actualVal -eq "true" -or $actualVal -eq "false") {
X "$indent`t<dcscor:value xsi:type=`"xs:boolean`">$actualVal</dcscor:value>"
} elseif ($key -eq "Текст" -or $key -eq "Заголовок" -or $key -eq "Формат") {
X "$indent`t<dcscor:value xsi:type=`"v8:LocalStringType`">"
X "$indent`t`t<v8:item>"
X "$indent`t`t`t<v8:lang>ru</v8:lang>"
X "$indent`t`t`t<v8:content>$(Esc-Xml $actualVal)</v8:content>"
X "$indent`t`t</v8:item>"
X "$indent`t</dcscor:value>"
Emit-MLText -tag "dcscor:value" -text $actualVal -indent "$indent`t"
} else {
X "$indent`t<dcscor:value xsi:type=`"xs:string`">$(Esc-Xml $actualVal)</dcscor:value>"
}
@@ -1831,12 +1819,7 @@ function Emit-OutputParameters {
X "$indent`t<dcscor:item xsi:type=`"dcsset:SettingsParameterValue`">"
X "$indent`t`t<dcscor:parameter>$(Esc-Xml $key)</dcscor:parameter>"
if ($ptype -eq "mltext") {
X "$indent`t`t<dcscor:value xsi:type=`"v8:LocalStringType`">"
X "$indent`t`t`t<v8:item>"
X "$indent`t`t`t`t<v8:lang>ru</v8:lang>"
X "$indent`t`t`t`t<v8:content>$(Esc-Xml $val)</v8:content>"
X "$indent`t`t`t</v8:item>"
X "$indent`t`t</dcscor:value>"
Emit-MLText -tag "dcscor:value" -text $val -indent "$indent`t`t"
} else {
X "$indent`t`t<dcscor:value xsi:type=`"$ptype`">$(Esc-Xml $val)</dcscor:value>"
}
@@ -1925,12 +1908,7 @@ function Emit-DataParameters {
}
if ($dp.userSettingPresentation) {
X "$indent`t`t<dcsset:userSettingPresentation xsi:type=`"v8:LocalStringType`">"
X "$indent`t`t`t<v8:item>"
X "$indent`t`t`t`t<v8:lang>ru</v8:lang>"
X "$indent`t`t`t`t<v8:content>$(Esc-Xml "$($dp.userSettingPresentation)")</v8:content>"
X "$indent`t`t`t</v8:item>"
X "$indent`t`t</dcsset:userSettingPresentation>"
Emit-MLText -tag "dcsset:userSettingPresentation" -text $dp.userSettingPresentation -indent "$indent`t`t"
}
X "$indent`t</dcscor:item>"
@@ -2166,13 +2144,8 @@ function Emit-SettingsVariants {
X "`t<settingsVariant>"
X "`t`t<dcsset:name>$(Esc-Xml "$($v.name)")</dcsset:name>"
$pres = if ($v.presentation) { "$($v.presentation)" } elseif ($v.title) { "$($v.title)" } else { "$($v.name)" }
X "`t`t<dcsset:presentation xsi:type=`"v8:LocalStringType`">"
X "`t`t`t<v8:item>"
X "`t`t`t`t<v8:lang>ru</v8:lang>"
X "`t`t`t`t<v8:content>$(Esc-Xml $pres)</v8:content>"
X "`t`t`t</v8:item>"
X "`t`t</dcsset:presentation>"
$pres = if ($v.presentation) { $v.presentation } elseif ($v.title) { $v.title } else { "$($v.name)" }
Emit-MLText -tag "dcsset:presentation" -text $pres -indent "`t`t"
X "`t`t<dcsset:settings xmlns:style=`"http://v8.1c.ru/8.1/data/ui/style`" xmlns:sys=`"http://v8.1c.ru/8.1/data/ui/fonts/system`" xmlns:web=`"http://v8.1c.ru/8.1/data/ui/colors/web`" xmlns:win=`"http://v8.1c.ru/8.1/data/ui/colors/windows`">"
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# skd-compile v1.20 — Compile 1C DCS from JSON
# skd-compile v1.21 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import json
@@ -41,10 +41,18 @@ def emit_mltext(lines, indent, tag, text):
lines.append(f"{indent}<{tag}/>")
return
lines.append(f'{indent}<{tag} xsi:type="v8:LocalStringType">')
lines.append(f"{indent}\t<v8:item>")
lines.append(f"{indent}\t\t<v8:lang>ru</v8:lang>")
lines.append(f"{indent}\t\t<v8:content>{esc_xml(text)}</v8:content>")
lines.append(f"{indent}\t</v8:item>")
# Multi-lang: object form { ru: "...", en: "..." } -- one <v8:item> per language
if isinstance(text, dict):
for lang, content in text.items():
lines.append(f"{indent}\t<v8:item>")
lines.append(f"{indent}\t\t<v8:lang>{esc_xml(str(lang))}</v8:lang>")
lines.append(f"{indent}\t\t<v8:content>{esc_xml(str(content))}</v8:content>")
lines.append(f"{indent}\t</v8:item>")
else:
lines.append(f"{indent}\t<v8:item>")
lines.append(f"{indent}\t\t<v8:lang>ru</v8:lang>")
lines.append(f"{indent}\t\t<v8:content>{esc_xml(str(text))}</v8:content>")
lines.append(f"{indent}\t</v8:item>")
lines.append(f"{indent}</{tag}>")
@@ -496,7 +504,7 @@ def emit_field(lines, field_def, indent):
f = {
'dataPath': str(field_def.get('dataPath', '')) or str(field_def.get('field', '')),
'field': str(field_def.get('field', '')) or str(field_def.get('dataPath', '')),
'title': str(field_def.get('title', '')) if field_def.get('title') else '',
'title': field_def.get('title') if field_def.get('title') else '',
'type': (
[resolve_type_str(str(t)) for t in field_def['type']]
if isinstance(field_def['type'], list)
@@ -698,7 +706,7 @@ def emit_calc_fields(lines, defn):
data_path = str(cf.get('dataPath') or cf.get('field') or cf.get('name') or '')
expression = str(cf.get('expression', ''))
if cf.get('title'):
title = str(cf['title'])
title = cf['title']
if cf.get('type'):
type_str = resolve_type_str(str(cf['type']))
@@ -823,11 +831,11 @@ def emit_single_param(lines, p, parsed):
# a synonym — 1C UI labels a parameter's caption "Представление").
title = ''
if parsed.get('title'):
title = str(parsed['title'])
title = parsed['title']
elif p is not None and not isinstance(p, str) and p.get('title'):
title = str(p['title'])
title = p['title']
elif p is not None and not isinstance(p, str) and p.get('presentation'):
title = str(p['presentation'])
title = p['presentation']
if title:
emit_mltext(lines, '\t\t', 'title', title)
@@ -873,14 +881,9 @@ def emit_single_param(lines, p, parsed):
lines.append('\t\t<availableValue>')
lines.append(f'\t\t\t<value xsi:type="{av_type}">{esc_xml(av_val)}</value>')
# `title` accepted as synonym of `presentation` — both map to the same UI label.
av_pres = str(av.get('presentation') or av.get('title') or '')
av_pres = av.get('presentation') or av.get('title') or ''
if av_pres:
lines.append('\t\t\t<presentation xsi:type="v8:LocalStringType">')
lines.append('\t\t\t\t<v8:item>')
lines.append('\t\t\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'\t\t\t\t\t<v8:content>{esc_xml(av_pres)}</v8:content>')
lines.append('\t\t\t\t</v8:item>')
lines.append('\t\t\t</presentation>')
emit_mltext(lines, '\t\t\t', 'presentation', av_pres)
lines.append('\t\t</availableValue>')
# DenyIncompleteValues
@@ -1208,12 +1211,7 @@ def _emit_area_template_dsl(lines, t):
cell_extra_items.append('\t\t\t\t\t</dcscor:item>')
else:
lines.append('\t\t\t\t\t<dcsat:item xsi:type="dcsat:Field">')
lines.append('\t\t\t\t\t\t<dcsat:value xsi:type="v8:LocalStringType">')
lines.append('\t\t\t\t\t\t\t<v8:item>')
lines.append('\t\t\t\t\t\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'\t\t\t\t\t\t\t\t<v8:content>{esc_xml(cell_str)}</v8:content>')
lines.append('\t\t\t\t\t\t\t</v8:item>')
lines.append('\t\t\t\t\t\t</dcsat:value>')
emit_mltext(lines, '\t\t\t\t\t\t', 'dcsat:value', cell_str)
lines.append('\t\t\t\t\t</dcsat:item>')
h = min_height if r == 0 else 0
_emit_cell_appearance(lines, style, w, False, False, h, cell_extra_items or None)
@@ -1397,12 +1395,7 @@ def emit_filter_item(lines, item, indent):
lines.append(f'{indent}\t<dcsset:right xsi:type="{vt}">{v_str}</dcsset:right>')
if item.get('presentation'):
lines.append(f'{indent}\t<dcsset:presentation xsi:type="v8:LocalStringType">')
lines.append(f'{indent}\t\t<v8:item>')
lines.append(f'{indent}\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'{indent}\t\t\t<v8:content>{esc_xml(str(item["presentation"]))}</v8:content>')
lines.append(f'{indent}\t\t</v8:item>')
lines.append(f'{indent}\t</dcsset:presentation>')
emit_mltext(lines, f'{indent}\t', 'dcsset:presentation', item["presentation"])
if item.get('viewMode'):
lines.append(f'{indent}\t<dcsset:viewMode>{esc_xml(str(item["viewMode"]))}</dcsset:viewMode>')
@@ -1412,12 +1405,7 @@ def emit_filter_item(lines, item, indent):
lines.append(f'{indent}\t<dcsset:userSettingID>{esc_xml(uid)}</dcsset:userSettingID>')
if item.get('userSettingPresentation'):
lines.append(f'{indent}\t<dcsset:userSettingPresentation xsi:type="v8:LocalStringType">')
lines.append(f'{indent}\t\t<v8:item>')
lines.append(f'{indent}\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'{indent}\t\t\t<v8:content>{esc_xml(str(item["userSettingPresentation"]))}</v8:content>')
lines.append(f'{indent}\t\t</v8:item>')
lines.append(f'{indent}\t</dcsset:userSettingPresentation>')
emit_mltext(lines, f'{indent}\t', 'dcsset:userSettingPresentation', item["userSettingPresentation"])
lines.append(f'{indent}</dcsset:item>')
@@ -1492,12 +1480,7 @@ def emit_appearance_value(lines, key, val, indent):
elif actual_val == 'true' or actual_val == 'false':
lines.append(f'{indent}\t<dcscor:value xsi:type="xs:boolean">{actual_val}</dcscor:value>')
elif key in ('\u0422\u0435\u043a\u0441\u0442', '\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a', '\u0424\u043e\u0440\u043c\u0430\u0442'):
lines.append(f'{indent}\t<dcscor:value xsi:type="v8:LocalStringType">')
lines.append(f'{indent}\t\t<v8:item>')
lines.append(f'{indent}\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'{indent}\t\t\t<v8:content>{esc_xml(actual_val)}</v8:content>')
lines.append(f'{indent}\t\t</v8:item>')
lines.append(f'{indent}\t</dcscor:value>')
emit_mltext(lines, f'{indent}\t', 'dcscor:value', actual_val)
else:
lines.append(f'{indent}\t<dcscor:value xsi:type="xs:string">{esc_xml(actual_val)}</dcscor:value>')
lines.append(f'{indent}</dcscor:item>')
@@ -1562,12 +1545,7 @@ def emit_output_parameters(lines, params, indent):
lines.append(f'{indent}\t<dcscor:item xsi:type="dcsset:SettingsParameterValue">')
lines.append(f'{indent}\t\t<dcscor:parameter>{esc_xml(key)}</dcscor:parameter>')
if ptype == 'mltext':
lines.append(f'{indent}\t\t<dcscor:value xsi:type="v8:LocalStringType">')
lines.append(f'{indent}\t\t\t<v8:item>')
lines.append(f'{indent}\t\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'{indent}\t\t\t\t<v8:content>{esc_xml(val_str)}</v8:content>')
lines.append(f'{indent}\t\t\t</v8:item>')
lines.append(f'{indent}\t\t</dcscor:value>')
emit_mltext(lines, f'{indent}\t\t', 'dcscor:value', val_str)
else:
lines.append(f'{indent}\t\t<dcscor:value xsi:type="{ptype}">{esc_xml(val_str)}</dcscor:value>')
lines.append(f'{indent}\t</dcscor:item>')
@@ -1637,12 +1615,7 @@ def emit_data_parameters(lines, items, indent):
lines.append(f'{indent}\t\t<dcsset:userSettingID>{esc_xml(uid)}</dcsset:userSettingID>')
if dp.get('userSettingPresentation'):
lines.append(f'{indent}\t\t<dcsset:userSettingPresentation xsi:type="v8:LocalStringType">')
lines.append(f'{indent}\t\t\t<v8:item>')
lines.append(f'{indent}\t\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'{indent}\t\t\t\t<v8:content>{esc_xml(str(dp["userSettingPresentation"]))}</v8:content>')
lines.append(f'{indent}\t\t\t</v8:item>')
lines.append(f'{indent}\t\t</dcsset:userSettingPresentation>')
emit_mltext(lines, f'{indent}\t\t', 'dcsset:userSettingPresentation', dp["userSettingPresentation"])
lines.append(f'{indent}\t</dcscor:item>')
lines.append(f'{indent}</dcsset:dataParameters>')
@@ -1824,13 +1797,8 @@ def emit_settings_variants(lines, defn):
lines.append('\t<settingsVariant>')
lines.append(f'\t\t<dcsset:name>{esc_xml(str(v["name"]))}</dcsset:name>')
pres = str(v.get('presentation', '')) or str(v.get('title', '')) or str(v['name'])
lines.append('\t\t<dcsset:presentation xsi:type="v8:LocalStringType">')
lines.append('\t\t\t<v8:item>')
lines.append('\t\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'\t\t\t\t<v8:content>{esc_xml(pres)}</v8:content>')
lines.append('\t\t\t</v8:item>')
lines.append('\t\t</dcsset:presentation>')
pres = v.get('presentation') or v.get('title') or v['name']
emit_mltext(lines, '\t\t', 'dcsset:presentation', pres)
lines.append('\t\t<dcsset:settings xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows">')
@@ -0,0 +1,33 @@
{
"name": "Многоязычные title и presentation (ru + en)",
"params": { "outputPath": "Template.xml" },
"input": {
"dataSets": [{
"name": "Основной",
"query": "ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т",
"fields": [
{ "field": "Сумма", "title": { "ru": "Сумма продажи", "en": "Sale amount" }, "type": "decimal(15,2)" }
]
}],
"calculatedFields": [
{ "name": "Маржа", "title": { "ru": "Маржа", "en": "Margin" }, "expression": "Сумма * 0.2" }
],
"totalFields": [
{ "dataPath": "Сумма", "title": { "ru": "Итого, руб.", "en": "Total, RUB" }, "expression": "Сумма(Сумма)" }
],
"parameters": [
{ "name": "Период", "title": { "ru": "Период", "en": "Period" }, "type": "StandardPeriod" }
],
"settingsVariants": [{
"name": "Основной",
"title": { "ru": "Продажи", "en": "Sales" },
"settings": {
"selection": ["Сумма", "Маржа", "Auto"]
}
}]
},
"validatePath": "Template.xml",
"expect": {
"files": ["Template.xml"]
}
}
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<DataCompositionSchema xmlns="http://v8.1c.ru/8.1/data-composition-system/schema"
xmlns:dcscom="http://v8.1c.ru/8.1/data-composition-system/common"
xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core"
xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings"
xmlns:v8="http://v8.1c.ru/8.1/data/core"
xmlns:v8ui="http://v8.1c.ru/8.1/data/ui"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dataSource>
<name>ИсточникДанных1</name>
<dataSourceType>Local</dataSourceType>
</dataSource>
<dataSet xsi:type="DataSetQuery">
<name>Основной</name>
<field xsi:type="DataSetFieldField">
<dataPath>Сумма</dataPath>
<field>Сумма</field>
<title xsi:type="v8:LocalStringType">
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Сумма продажи</v8:content>
</v8:item>
<v8:item>
<v8:lang>en</v8:lang>
<v8:content>Sale amount</v8:content>
</v8:item>
</title>
<valueType>
<v8:Type>xs:decimal</v8:Type>
<v8:NumberQualifiers>
<v8:Digits>15</v8:Digits>
<v8:FractionDigits>2</v8:FractionDigits>
<v8:AllowedSign>Any</v8:AllowedSign>
</v8:NumberQualifiers>
</valueType>
</field>
<dataSource>ИсточникДанных1</dataSource>
<query>ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т</query>
</dataSet>
<calculatedField>
<dataPath>Маржа</dataPath>
<expression>Сумма * 0.2</expression>
<title xsi:type="v8:LocalStringType">
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Маржа</v8:content>
</v8:item>
<v8:item>
<v8:lang>en</v8:lang>
<v8:content>Margin</v8:content>
</v8:item>
</title>
</calculatedField>
<totalField>
<dataPath>Сумма</dataPath>
<expression>Сумма(Сумма)</expression>
</totalField>
<parameter>
<name>Период</name>
<title xsi:type="v8:LocalStringType">
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Период</v8:content>
</v8:item>
<v8:item>
<v8:lang>en</v8:lang>
<v8:content>Period</v8:content>
</v8:item>
</title>
<valueType>
<v8:Type>v8:StandardPeriod</v8:Type>
</valueType>
</parameter>
<settingsVariant>
<dcsset:name>Основной</dcsset:name>
<dcsset:presentation xsi:type="v8:LocalStringType">
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Продажи</v8:content>
</v8:item>
<v8:item>
<v8:lang>en</v8:lang>
<v8:content>Sales</v8:content>
</v8:item>
</dcsset:presentation>
<dcsset:settings xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows">
<dcsset:selection>
<dcsset:item xsi:type="dcsset:SelectedItemField">
<dcsset:field>Сумма</dcsset:field>
</dcsset:item>
<dcsset:item xsi:type="dcsset:SelectedItemField">
<dcsset:field>Маржа</dcsset:field>
</dcsset:item>
</dcsset:selection>
</dcsset:settings>
</settingsVariant>
</DataCompositionSchema>