feat(cicero-core): add support for Concerto vocabularies#882
Open
Anexus5919 wants to merge 1 commit intoaccordproject:mainfrom
Open
feat(cicero-core): add support for Concerto vocabularies#882Anexus5919 wants to merge 1 commit intoaccordproject:mainfrom
Anexus5919 wants to merge 1 commit intoaccordproject:mainfrom
Conversation
…ct#711) Add locale-specific vocabulary support to Cicero templates using Concerto's VocabularyManager. Templates can now include .voc files in a vocab/ directory to provide localized labels for model concepts and properties. Changes: - Load/save .voc files from vocab/ directory and archives - Add VocabularyManager to Template with getVocabulary() fallback - Add defaultLocale to Metadata (package.json accordproject section) - Add 'cicero vocabulary' CLI command with --locale option - Add test fixtures with English and French vocabularies - 20 new tests covering loading, round-trip, fallback, and CLI Closes accordproject#711 Signed-off-by: Adarsh Singh <anexus5919@gmail.com>
d7c53a9 to
1d81787
Compare
Author
|
Hi @mttrbrts @dselman @ekarademir , I've opened a PR that implements vocabulary support for Cicero templates: #882 Here's what the PR covers:
Happy to adjust the approach based on feedback. Would love to hear if vocab/ works as the canonical location or if you'd prefer something different. |
Author
|
@ekarademir @dselman @DianaLease I have raised this PR 4 days ago... Can you please review it when you get a chance! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #711
Summary
This PR adds locale-specific vocabulary support to Cicero templates using Concerto's existing
VocabularyManager. Templates can now include.vocfiles (YAML) in avocab/directory to provide localized labels/terms for model concepts and properties..vocfiles fromvocab/directory and.ctaarchives with full round-trip fidelity (raw YAML preserved)VocabularyManageron Template — exposed viagetVocabularyManager()for direct access to Concerto's vocabulary APIgetVocabulary(namespace, locale)convenience method with automatic fallback todefaultLocaledefaultLocalein Metadata — optional field underaccordprojectinpackage.json(e.g."defaultLocale": "en")cicero vocabularyCLI command — list available vocabularies or query terms for a specific--localeDesign decisions
.vocfiles live invocab/at template rootmodel/,text/,logic/; aligns with Concerto codegen conventions.vocstrings stored alongside parsedVocabularyManageryamlas a dependencydefaultLocaleis optionalVocabularyManagerlives onTemplateModelManagerin concerto-core has no vocabulary integration; follows same aggregation pattern asScriptManager/LogicManagerExample
A template with vocabulary support looks like:
The
.vocfiles follow Concerto's YAML vocabulary format:Files changed
cicero-core (source):
metadata.js,template.js,templateloader.js,templatesaver.js,package.jsoncicero-cli:
commands.js,index.jsTests:
vocabulary.js(15 new tests),cli.js(5 new tests),template.js(hash updates)Fixtures:
latedeliveryandpenalty-vocab/with English + French.vocfilesTest plan
defaultLocaleread from package.json and preserved through archivegetVocabulary()falls back todefaultLocalewhen requested locale missing.ctaarchive (save → reload → verify terms)getHash()computationvocabularycommand lists files and queries terms