Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
/src
*.pyc

/docs/_static/process-level
/docs/_static/project-level
# json-schema-random
/node_modules
/package-lock.json
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ default_language_version:
python: python3.10
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.11.4
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.14
rev: 0.6.12
hooks:
- id: pip-compile
name: pip-compile common-requirements.in
Expand Down
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ resource_name = infrastructure-schema
replace_edited_strings = false
keep_translations = false

[o:open-contracting-partnership-1:p:oc4ids-09:r:infrastructure-sustainability-mapping]
file_filter = docs/locale/<lang>/LC_MESSAGES/infrastructure-sustainability-mapping.po
source_file = build/locale/infrastructure-sustainability-mapping.pot
type = PO
minimum_perc = 0
resource_name = infrastructure-sustainability-mapping
replace_edited_strings = false
keep_translations = false

[o:open-contracting-partnership-1:p:oc4ids-09:r:projects--index]
file_filter = docs/locale/<lang>/LC_MESSAGES/projects/index.po
source_file = build/locale/projects/index.pot
Expand Down
5 changes: 5 additions & 0 deletions babel_oc4ids_sustainability_mapping.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[extractors]
yaml = ocds_babel.extract:extract_yaml

[yaml: mapping/sustainability.yaml]
keys = title,disclosure format,mapping
2 changes: 1 addition & 1 deletion babel_ocds_mapping.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[ocds_codelist: mapping/*.csv]
headers = CoST IDS element,CoST IDS draft definition,Mapping to OC4IDS,Mapping from OCDS
headers = CoST IDS element,Description,Mapping to OC4IDS,Mapping from OCDS
8 changes: 4 additions & 4 deletions common-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exceptiongroup==1.2.2
# anyio
# cattrs
# pytest
h11==0.13.0
h11==0.16.0
# via
# uvicorn
# wsproto
Expand Down Expand Up @@ -88,7 +88,7 @@ mdurl==0.1.2
# via markdown-it-py
myst-parser==0.18.1
# via -r common-requirements.in
ocds-babel==0.3.6
ocds-babel==0.3.7
# via -r common-requirements.in
ocdsextensionregistry==0.6.5
# via -r common-requirements.in
Expand Down Expand Up @@ -124,7 +124,7 @@ requests-cache==1.1.0
# via ocdsextensionregistry
selenium==4.11.2
# via -r common-requirements.in
setuptools==75.2.0
setuptools==80.3.1
# via sphinx-intl
six==1.16.0
# via url-normalize
Expand Down Expand Up @@ -158,7 +158,7 @@ sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
standard-theme @ git+https://github.com/open-contracting/standard_theme.git@d56505d69fceeb43535a3387172b2024eead536e#egg=standard_theme
standard-theme @ git+https://github.com/open-contracting/standard_theme.git@185b1be837be4158bf7e04c143bca0911862e35b#egg=standard_theme
# via -r common-requirements.in
starlette==0.40.0
# via sphinx-autobuild
Expand Down
36 changes: 23 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
myst_enable_extensions = ["linkify"]
myst_heading_anchors = 6
myst_heading_slug_func = make_id
# WARNING: cannot cache unpickable configuration value: 'myst_heading_slug_func'
suppress_warnings = ["config.cache"]

# Theme customization.
navigation_with_keys = False # restore the Sphinx default
Expand All @@ -99,7 +101,7 @@
"license_url": f"{repository_url}/blob/HEAD/LICENSE",
"repository_url": repository_url,
}
html_short_title = f'{html_theme_options["short_project"]} v{release}'
html_short_title = f"{html_theme_options['short_project']} v{release}"


def setup(app):
Expand All @@ -110,48 +112,57 @@ def setup(app):

language = app.config.overrides.get("language", "en")

# Headers for columns to translate in codelist CSVs. The headers in babel_ocds_mapping.cfg should match these.
codelist_headers = ["Title", "Description", "Extension", "Business Logic"]
# Headers for columns to translate in mapping CSVs. The headers in babel_ocds_mapping.cfg should match these.
mapping_headers = ["CoST IDS element", "CoST IDS draft definition", "Mapping to OC4IDS", "Mapping from OCDS"]

# The gettext domain for schema translations. Should match the domain in the `pybabel compile` command.
schema_domain = f"{gettext_domain_prefix}schema"
# The gettext domain for codelist translations. Should match the domain in the `pybabel compile` command.
codelists_domain = f"{gettext_domain_prefix}codelists"
# The gettext domain for mapping translations. Should match the domain in the `pybabel compile` command.
mapping_domain = f"{gettext_domain_prefix}mappings"
# The gettext domain for sustainability mapping translations.
# Should match the domain in the `pybabel compile` command.
sustainability_mapping_domain = f"{gettext_domain_prefix}sustainability-mapping"

schema_dir = basedir / "schema" / "project-level"
static_dir = basedir / "docs" / "_static" / "project-level"
build_dir = basedir / "build" / language

branch = os.getenv("GITHUB_REF_NAME", "latest")

translate(
[
# The glob patterns in `babel_ocds_schema.cfg` should match these filenames.
(glob(str(schema_dir / "*-schema.json")), static_dir, schema_domain),
(glob(str(schema_dir / "*-schema.json")), build_dir, schema_domain),
# The glob patterns in `babel_ocds_codelist.cfg` should match these.
(glob(str(schema_dir / "codelists" / "*.csv")), static_dir / "codelists", codelists_domain),
(glob(str(schema_dir / "codelists" / "*.csv")), build_dir / "codelists", codelists_domain),
],
localedir,
language,
codelist_headers,
# Headers for columns to translate in codelist CSVs. The headers in babel_ocds_mapping.cfg should match these.
["Title", "Description", "Extension", "Business Logic"],
version=branch,
)

translate(
[
# The glob patterns in `babel_ocds_mapping.cfg` should match these filenames.
(glob(str(basedir / "mapping" / "*.csv")), static_dir, mapping_domain),
(glob(str(basedir / "mapping" / "*.csv")), build_dir, mapping_domain),
],
localedir,
language,
mapping_headers,
# Headers for columns to translate in mapping CSVs. The headers in babel_ocds_mapping.cfg should match these.
["CoST IDS element", "Description", "Mapping to OC4IDS", "Mapping from OCDS"],
version=branch,
)

translate(
[
# The glob patterns in `babel_oc4ids_sustainability_mapping.cfg` should match these.
(glob(str(basedir / "mapping" / "sustainability.yaml")), build_dir, sustainability_mapping_domain),
],
localedir,
language,
[],
# Keys for values to translate in sustainability.yaml. Should match babel_oc4ids_sustainability_mapping.cfg.
keys=["title", "disclosure format", "mapping"],
version=branch,
)

Expand All @@ -166,4 +177,3 @@ def setup(app):
for row in reader:
del row[column_index] # Drop mapping column
writer.writerow(row[0:3]) # Drop OC4IDS Fields and OC4IDS Codes columns
path.unlink()
Loading