Commit fe5abe0 1 parent 3e1b85c commit fe5abe0 Copy full SHA for fe5abe0
File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 31
31
"url" : OPENNOTIFICATIES_API_CONTACT_URL ,
32
32
},
33
33
"SERVE_INCLUDE_SCHEMA" : False ,
34
+ "DEFAULT_GENERATOR_CLASS" : "nrc.utils.schema.LocalizedSchemaGenerator" ,
34
35
"POSTPROCESSING_HOOKS" : [
35
36
"drf_spectacular.hooks.postprocess_schema_enums" ,
36
37
"drf_spectacular.contrib.djangorestframework_camel_case.camelize_serializer_fields" ,
Original file line number Diff line number Diff line change 1
1
import logging
2
2
3
3
from django .conf import settings
4
- from django .utils .translation import gettext_lazy as _
4
+ from django .utils .translation import activate , gettext_lazy as _
5
5
6
+ from drf_spectacular .generators import SchemaGenerator
6
7
from drf_spectacular .openapi import AutoSchema as _AutoSchema
7
8
from drf_spectacular .utils import OpenApiParameter , OpenApiTypes
8
9
from rest_framework import exceptions , mixins , serializers
@@ -186,3 +187,10 @@ def get_location_headers(self) -> list[OpenApiParameter]:
186
187
]
187
188
188
189
return []
190
+
191
+
192
+ class LocalizedSchemaGenerator (SchemaGenerator ):
193
+ def get_schema (self , request = None , public = True ):
194
+ # Force the schema to be generated in Dutch
195
+ activate ("nl-nl" )
196
+ return super ().get_schema (request , public )
You can’t perform that action at this time.
0 commit comments