Closed vj-addnode closed 6 months ago
Would you share a minimal example schema that demonstrates what you're trying to accomplish?
So, below is the yaml file in which there are fields. I am referring to first field i.e. 'Title'.
`scheming_version: 2 dataset_type: dataset about: A reimplementation of the default CKAN dataset schema about_url: http://github.com/ckan/ckanext-scheming
dataset_fields:
field_name: title label: Title preset: title form_placeholder: eg. A descriptive title
field_name: name label: URL preset: dataset_slug form_placeholder: eg. my-dataset
field_name: notes label: Description form_snippet: markdown.html form_placeholder: eg. Some useful notes about the data
field_name: tag_string label: Tags preset: tag_string_autocomplete form_placeholder: eg. economy, mental health, government
field_name: license_id label: License form_snippet: license.html help_text: License definitions and additional information can be found at http://opendefinition.org/
field_name: owner_org label: Organization preset: dataset_organization
field_name: url label: Source form_placeholder: http://example.com/dataset.json display_property: foaf:homepage display_snippet: link.html
field_name: version label: Version validators: ignore_missing unicode_safe package_version_validator form_placeholder: '1.0'
field_name: author label: Author form_placeholder: Joe Bloggs display_property: dc:creator
field_name: author_email label: Author Email form_placeholder: joe@example.com display_property: dc:creator display_snippet: email.html display_email_name_field: author
field_name: maintainer label: Maintainer form_placeholder: Joe Bloggs display_property: dc:contributor
field_name: maintainer_email label: Maintainer Email form_placeholder: joe@example.com display_property: dc:contributor display_snippet: email.html display_email_name_field: maintainer
field_name: custom_form_fields label: Custom Field form_snippet: snippets/custom_form_fields.html
resource_fields:
field_name: url label: URL preset: resource_url_upload
field_name: name label: Name form_placeholder: eg. January 2011 Gold Prices
field_name: description label: Description form_snippet: markdown.html form_placeholder: Some useful notes about the data
field_name: format label: Format preset: resource_format_autocomplete`
What you're trying to do isn't clear to me. Maybe you want to give the specific label translations in the yaml file like shown in the readme: https://github.com/ckan/ckanext-scheming?tab=readme-ov-file#label instead of using gettext?
Note that scheming doesn't override every instance of the word "Title" across ckan so this will only work in the form. For other instances you need to override templates or use custom translations.
Thanks, giving field translations in yaml file directly is working. I have custom HTML templates for which I generated .po file and was trying to translate using that.
I gave a custom dataset schema yaml file for the fields and also generated a .Pot, .po and .mo files for the translations but that is not working. For ex., I gave field name & label as 'Title' for the title field so instead of translating it is just giving label name as 'Heading' in english and 'Rubrik' in swedish. Can anyone of you let me know how I can give custom label names to those fields ? Simply I just want to give custom heading and placeholder to those fields.