richie 3.1.3.dev8__py2.py3-none-any.whl → 3.1.3.dev11__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of richie might be problematic. Click here for more details.

@@ -51,7 +51,20 @@ for site_language in LANGUAGES_DICT:
51
51
  # regions.
52
52
  RFC_5646_LOCALES = lazy(
53
53
  lambda: getattr(
54
- settings, "RFC_5646_LOCALES", ["en-US", "es-ES", "pt-PT", "fr-FR", "fr-CA"]
54
+ settings,
55
+ "RFC_5646_LOCALES",
56
+ [
57
+ "en-US",
58
+ "es-ES",
59
+ "pt-PT",
60
+ "pt-BR",
61
+ "fr-FR",
62
+ "fr-CA",
63
+ "ru-RU",
64
+ "vi-VN",
65
+ "ar-SA",
66
+ "ko-KR",
67
+ ],
55
68
  ),
56
69
  list,
57
70
  )()
@@ -5,7 +5,7 @@ from django.conf import settings
5
5
  from django.utils import translation
6
6
 
7
7
  # do not use the lazy
8
- from django.utils.translation import gettext as _
8
+ from django.utils.translation import gettext_lazy as _
9
9
 
10
10
  register = template.Library()
11
11
 
@@ -1,6 +1,8 @@
1
1
  """Parameters that define how the demo site will be built."""
2
2
 
3
3
  from django.conf import settings
4
+ from django.utils import translation
5
+ from django.utils.translation import gettext_lazy as _
4
6
 
5
7
  from .utils import pick_image
6
8
 
@@ -36,60 +38,82 @@ NB_OBJECTS = {
36
38
  }
37
39
  NB_OBJECTS.update(getattr(settings, "RICHIE_DEMO_NB_OBJECTS", {}))
38
40
 
41
+ languages = getattr(settings, "LANGUAGES", ())
42
+
43
+
44
+ def translate_message(code, label):
45
+ """Translate a message in a specific language."""
46
+
47
+ with translation.override(code):
48
+ new_label = str(_(label))
49
+ return new_label
50
+
51
+
52
+ def set_labels_by_language(label):
53
+ """Set a label for all languages."""
54
+
55
+ labels = {}
56
+
57
+ for language in languages:
58
+ labels.update({str(language[0]): translate_message(language[0], label)})
59
+
60
+ return labels
61
+
62
+
39
63
  PAGES_INFO = {
40
64
  "home": {
41
- "title": {"en": "Home", "fr": "Accueil"},
65
+ "title": set_labels_by_language("Home"),
42
66
  "in_navigation": False,
43
67
  "is_homepage": True,
44
68
  "template": "richie/homepage.html",
45
69
  },
46
70
  "blogposts": {
47
- "title": {"en": "News", "fr": "Actualités"},
71
+ "title": set_labels_by_language("News"),
48
72
  "in_navigation": True,
49
73
  "template": "courses/cms/blogpost_list.html",
50
74
  },
51
75
  "courses": {
52
- "title": {"en": "Courses", "fr": "Cours"},
76
+ "title": set_labels_by_language("Courses"),
53
77
  "in_navigation": True,
54
78
  "template": "search/search.html",
55
79
  },
56
80
  "categories": {
57
- "title": {"en": "Categories", "fr": "Catégories"},
81
+ "title": set_labels_by_language("Categories"),
58
82
  "in_navigation": True,
59
83
  "template": "courses/cms/category_list.html",
60
84
  },
61
85
  "organizations": {
62
- "title": {"en": "Organizations", "fr": "Établissements"},
86
+ "title": set_labels_by_language("Organizations"),
63
87
  "in_navigation": True,
64
88
  "template": "courses/cms/organization_list.html",
65
89
  },
66
90
  "persons": {
67
- "title": {"en": "Persons", "fr": "Personnes"},
91
+ "title": set_labels_by_language("Persons"),
68
92
  "in_navigation": True,
69
93
  "template": "courses/cms/person_list.html",
70
94
  },
71
95
  "programs": {
72
- "title": {"en": "Programs", "fr": "Parcours"},
96
+ "title": set_labels_by_language("Programs"),
73
97
  "in_navigation": True,
74
98
  "template": "courses/cms/program_list.html",
75
99
  },
76
100
  "annex": {
77
- "title": {"en": "Annex", "fr": "Annexe"},
101
+ "title": set_labels_by_language("Annex"),
78
102
  "in_navigation": False,
79
103
  "template": "richie/single_column.html",
80
104
  "children": {
81
105
  "annex__about": {
82
- "title": {"en": "About", "fr": "A propos"},
106
+ "title": set_labels_by_language("About"),
83
107
  "in_navigation": True,
84
108
  "template": "richie/single_column.html",
85
109
  },
86
110
  "annex__sitemap": {
87
- "title": {"en": "Sitemap", "fr": "Plan de site"},
111
+ "title": set_labels_by_language("Sitemap"),
88
112
  "in_navigation": True,
89
113
  "template": "richie/single_column.html",
90
114
  },
91
115
  "login-error": {
92
- "title": {"en": "Login error", "fr": "Erreur de connexion"},
116
+ "title": set_labels_by_language("Login error"),
93
117
  "in_navigation": False,
94
118
  "template": "richie/single_column.html",
95
119
  },
@@ -100,202 +124,136 @@ PAGES_INFO.update(getattr(settings, "RICHIE_DEMO_PAGES_INFO", {}))
100
124
 
101
125
 
102
126
  LEVELS_INFO = {
103
- "page_title": {"en": "Level", "fr": "Niveau"},
127
+ "page_title": set_labels_by_language("Level"),
104
128
  "children": [
105
- {"page_title": {"en": "Beginner", "fr": "Débutant"}},
106
- {"page_title": {"en": "Advanced", "fr": "Avancé"}},
107
- {"page_title": {"en": "Expert", "fr": "Expert"}},
129
+ {"page_title": set_labels_by_language("Beginner")},
130
+ {"page_title": set_labels_by_language("Advanced")},
131
+ {"page_title": set_labels_by_language("Expert")},
108
132
  ],
109
133
  "page_reverse_id": "levels",
110
134
  }
111
135
  LEVELS_INFO.update(getattr(settings, "RICHIE_DEMO_LEVELS_INFO", {}))
112
136
 
113
137
  PARTNERSHIPS_INFO = {
114
- "page_title": {"en": "Partnership", "fr": "Partenariat"},
138
+ "page_title": set_labels_by_language("Partnership"),
115
139
  "children": [
116
- {"page_title": {"en": "Gold", "fr": "Or"}},
117
- {"page_title": {"en": "Silver", "fr": "Argent"}},
118
- {"page_title": {"en": "Bronze", "fr": "Bronze"}},
140
+ {"page_title": set_labels_by_language("Gold")},
141
+ {"page_title": set_labels_by_language("Silver")},
142
+ {"page_title": set_labels_by_language("Bronze")},
119
143
  ],
120
144
  "page_reverse_id": "partnerships",
121
145
  }
122
146
  PARTNERSHIPS_INFO.update(getattr(settings, "RICHIE_DEMO_PARTNERSHIPS_INFO", {}))
123
147
 
124
148
  TAGS_INFO = {
125
- "page_title": {"en": "Tag", "fr": "Etiquette"},
149
+ "page_title": set_labels_by_language("Tag"),
126
150
  "children": [
127
- {"page_title": {"en": "Event", "fr": "Evénement"}},
128
- {"page_title": {"en": "Feature", "fr": "Fonctionnalité"}},
129
- {"page_title": {"en": "Around the course", "fr": "Autour du cours"}},
130
- {"page_title": {"en": "Partner", "fr": "Partenaire"}},
131
- {"page_title": {"en": "Portrait", "fr": "Portrait"}},
132
- {"page_title": {"en": "Recruitment", "fr": "Recrutement"}},
151
+ {"page_title": set_labels_by_language("Event")},
152
+ {"page_title": set_labels_by_language("Feature")},
153
+ {"page_title": set_labels_by_language("Around the course")},
154
+ {"page_title": set_labels_by_language("Partner")},
155
+ {"page_title": set_labels_by_language("Portrait")},
156
+ {"page_title": set_labels_by_language("Recruitment")},
133
157
  ],
134
158
  "page_reverse_id": "tags",
135
159
  }
136
160
  TAGS_INFO.update(getattr(settings, "RICHIE_DEMO_TAGS_INFO", {}))
137
161
 
138
162
  SUBJECTS_INFO = {
139
- "page_title": {"en": "Subject", "fr": "Sujet"},
163
+ "page_title": set_labels_by_language("Subject"),
140
164
  "children": [
141
165
  {
142
- "page_title": {"en": "Science", "fr": "Sciences"},
166
+ "page_title": set_labels_by_language("Science"),
143
167
  "children": [
168
+ {"page_title": set_labels_by_language("Agronomy and Agriculture")},
169
+ {"page_title": set_labels_by_language("Chemistry")},
170
+ {"page_title": set_labels_by_language("Discovery of the Universe")},
171
+ {"page_title": set_labels_by_language("Environment")},
172
+ {"page_title": set_labels_by_language("Mathematics and Statistics")},
173
+ {"page_title": set_labels_by_language("Tools for Research")},
174
+ {"page_title": set_labels_by_language("Physics")},
175
+ {"page_title": set_labels_by_language("Cognitive science")},
144
176
  {
145
- "page_title": {
146
- "en": "Agronomy and Agriculture",
147
- "fr": "Agronomie et Agriculture",
148
- }
149
- },
150
- {"page_title": {"en": "Chemistry", "fr": "Chimie"}},
151
- {
152
- "page_title": {
153
- "en": "Discovery of the Universe",
154
- "fr": "Découverte de l'Univers",
155
- }
156
- },
157
- {"page_title": {"en": "Environment", "fr": "Environnement"}},
158
- {
159
- "page_title": {
160
- "en": "Mathematics and Statistics",
161
- "fr": "Mathématiques et Statistiques",
162
- }
163
- },
164
- {
165
- "page_title": {
166
- "en": "Tools for Research",
167
- "fr": "Outils pour la Recherche",
168
- }
169
- },
170
- {"page_title": {"en": "Physics", "fr": "Physique"}},
171
- {
172
- "page_title": {
173
- "en": "Cognitive science",
174
- "fr": "Sciences cognitives",
175
- }
176
- },
177
- {
178
- "page_title": {
179
- "en": "Earth science and science of the Universe",
180
- "fr": "Sciences de la Terre et de l'Univers",
181
- }
182
- },
183
- {"page_title": {"en": "Life science", "fr": "Sciences de la vie"}},
184
- {
185
- "page_title": {
186
- "en": "Engineering science",
187
- "fr": "Sciences pour l'ingénieur",
188
- }
177
+ "page_title": set_labels_by_language(
178
+ "Earth science and science of the Universe"
179
+ )
189
180
  },
181
+ {"page_title": set_labels_by_language("Life science")},
182
+ {"page_title": set_labels_by_language("Engineering science")},
190
183
  ],
191
184
  },
192
185
  {
193
- "page_title": {
194
- "en": "Human and social sciences",
195
- "fr": "Sciences humaines et social",
196
- },
186
+ "page_title": set_labels_by_language("Human and social sciences"),
197
187
  "children": [
198
- {"page_title": {"en": "Communication", "fr": "Communication"}},
199
- {
200
- "page_title": {
201
- "en": "Creation, Arts and Design",
202
- "fr": "Création, Arts et Design",
203
- }
204
- },
205
- {
206
- "page_title": {
207
- "en": "Culture and Civilization",
208
- "fr": "Cultures et Civilisations",
209
- }
210
- },
188
+ {"page_title": set_labels_by_language("Communication")},
189
+ {"page_title": set_labels_by_language("Creation, Arts and Design")},
190
+ {"page_title": set_labels_by_language("Culture and Civilization")},
211
191
  {
212
- "page_title": {
213
- "en": "Social Issues and Social Policy",
214
- "fr": "Enjeux de société",
215
- }
192
+ "page_title": set_labels_by_language(
193
+ "Social Issues and Social Policy"
194
+ )
216
195
  },
217
- {"page_title": {"en": "Geography", "fr": "Géographie"}},
218
- {"page_title": {"en": "History", "fr": "Histoire"}},
219
- {"page_title": {"en": "Innovation", "fr": "Innovation"}},
220
- {"page_title": {"en": "Literature", "fr": "Lettres"}},
221
- {"page_title": {"en": "Media", "fr": "Médias"}},
222
- {"page_title": {"en": "Philosophy", "fr": "Philosophie"}},
223
- {
224
- "page_title": {
225
- "en": "Political science",
226
- "fr": "Sciences politiques",
227
- }
228
- },
229
- {
230
- "page_title": {
231
- "en": "International relations",
232
- "fr": "Relations internationales",
233
- }
234
- },
235
- {"page_title": {"en": "Sports", "fr": "Sport"}},
196
+ {"page_title": set_labels_by_language("Geography")},
197
+ {"page_title": set_labels_by_language("History")},
198
+ {"page_title": set_labels_by_language("Innovation")},
199
+ {"page_title": set_labels_by_language("Literature")},
200
+ {"page_title": set_labels_by_language("Media")},
201
+ {"page_title": set_labels_by_language("Philosophy")},
202
+ {"page_title": set_labels_by_language("Political science")},
203
+ {"page_title": set_labels_by_language("International relations")},
204
+ {"page_title": set_labels_by_language("Sports")},
236
205
  ],
237
206
  },
238
- {"page_title": {"en": "Law", "fr": "Droit et juridique"}},
239
- {"page_title": {"en": "Economy and Finance", "fr": "Economie et Finance"}},
207
+ {"page_title": set_labels_by_language("Law")},
208
+ {"page_title": set_labels_by_language("Economy and Finance")},
209
+ {"page_title": set_labels_by_language("Education and Training")},
210
+ {"page_title": set_labels_by_language("Management")},
211
+ {"page_title": set_labels_by_language("Entrepreneurship")},
240
212
  {
241
- "page_title": {
242
- "en": "Education and Training",
243
- "fr": "Education et formation",
244
- }
245
- },
246
- {"page_title": {"en": "Management", "fr": "Management"}},
247
- {"page_title": {"en": "Entrepreneurship", "fr": "Entreprenariat"}},
248
- {
249
- "page_title": {"en": "Computer science", "fr": "Informatique"},
213
+ "page_title": set_labels_by_language("Computer science"),
250
214
  "children": [
215
+ {"page_title": set_labels_by_language("Digital and Technology")},
251
216
  {
252
- "page_title": {
253
- "en": "Digital and Technology",
254
- "fr": "Numérique et Technologie",
255
- }
256
- },
257
- {
258
- "page_title": {
259
- "en": "Telecommunication and Networks",
260
- "fr": "Télécommunications et Réseaux",
261
- }
217
+ "page_title": set_labels_by_language(
218
+ "Telecommunication and Networks"
219
+ )
262
220
  },
263
- {"page_title": {"en": "Coding", "fr": "Programmation"}},
221
+ {"page_title": set_labels_by_language("Coding")},
264
222
  ],
265
223
  },
266
- {"page_title": {"en": "Languages", "fr": "Langues"}},
267
- {"page_title": {"en": "Education and career guidance", "fr": "Orientation"}},
268
- {"page_title": {"en": "Health", "fr": "Santé"}},
224
+ {"page_title": set_labels_by_language("Languages")},
225
+ {"page_title": set_labels_by_language("Education and career guidance")},
226
+ {"page_title": set_labels_by_language("Health")},
269
227
  ],
270
228
  "page_reverse_id": "subjects",
271
229
  }
272
230
  SUBJECTS_INFO.update(getattr(settings, "RICHIE_DEMO_SUBJECTS_INFO", {}))
273
231
 
274
232
  ICONS_INFO = {
275
- "page_title": {"en": "Icons", "fr": "Icônes"},
233
+ "page_title": set_labels_by_language("Icons"),
276
234
  "children": [
277
235
  {
278
- "page_title": {"en": "Academic", "fr": "Diplomant"},
236
+ "page_title": set_labels_by_language("Academic"),
279
237
  "color": "#005c08",
280
238
  "fill_icon": pick_image("icons")("academic.png"),
281
239
  },
282
240
  {
283
- "page_title": {"en": "Accessible", "fr": "Accessible"},
241
+ "page_title": set_labels_by_language("Accessible"),
284
242
  "color": "#00a1d6",
285
243
  "fill_icon": pick_image("icons")("accessible.png"),
286
244
  },
287
245
  {
288
- "page_title": {"en": "Closed caption", "fr": "Malentendants"},
246
+ "page_title": set_labels_by_language("Closed caption"),
289
247
  "color": "#a11000",
290
248
  "fill_icon": pick_image("icons")("cc.png"),
291
249
  },
292
250
  {
293
- "page_title": {"en": "Certificate", "fr": "Certifiant"},
251
+ "page_title": set_labels_by_language("Certificate"),
294
252
  "color": "#ffc400",
295
253
  "fill_icon": pick_image("icons")("certificate.png"),
296
254
  },
297
255
  {
298
- "page_title": {"en": "Subtitles", "fr": "Sous-titres"},
256
+ "page_title": set_labels_by_language("Subtitles"),
299
257
  "color": "#6d00ba",
300
258
  "fill_icon": pick_image("icons")("subtitles.png"),
301
259
  },
@@ -305,113 +263,70 @@ ICONS_INFO = {
305
263
  ICONS_INFO.update(getattr(settings, "RICHIE_DEMO_ICONS_INFO", {}))
306
264
 
307
265
  HOMEPAGE_CONTENT = {
308
- "en": {
309
- "banner_title": "Welcome to Richie",
266
+ str(code): {
267
+ "banner_title": translate_message(str(code), "Welcome to Richie"),
310
268
  "banner_content": (
311
- """<h1 class="hero-intro__title">Welcome <strong>to Richie</strong></h1>"""
312
- """<p>It works! This is the default homepage for the Richie CMS.</p>"""
269
+ f"""
270
+ <h1 class="hero-intro__title">{translate_message(str(code), "Welcome")}
271
+ <strong>{translate_message(str(code), "to Richie")}</strong></h1>
272
+ <p>{translate_message(str(code), "It works! This is the default homepage for the Richie CMS.")}</p>
273
+ """
313
274
  ),
314
275
  "banner_template": "richie/large_banner/hero-intro.html",
315
276
  "button_template_name": "button-caesura",
316
277
  "section_template": "richie/section/section.html",
317
- "blogposts_title": "Last news",
318
- "blogposts_button_title": "More news",
319
- "courses_title": "Popular courses",
320
- "courses_button_title": "More courses",
321
- "organizations_title": "Universities",
322
- "organizations_button_title": "More universities",
323
- "persons_title": "Persons",
324
- "persons_button_title": "More persons",
325
- "programs_title": "Programs",
326
- "programs_button_title": "More programs",
327
- "subjects_title": "Subjects",
328
- "subjects_button_title": "More subjects",
329
- },
330
- "fr": {
331
- "banner_title": "Bienvenue sur Richie",
332
- "banner_content": (
333
- """<h1 class="hero-intro__title">Bienvenue <strong>sur Richie</strong></h1>"""
334
- """<p>Ça marche ! Ceci est la page d'accueil par défaut du CMS Richie.</p>"""
335
- ),
336
- "banner_template": "richie/large_banner/hero-intro.html",
337
- "button_template_name": "button-caesura",
338
- "section_template": "richie/section/section.html",
339
- "blogposts_title": "Actualités récentes",
340
- "blogposts_button_title": "Plus d'actualités",
341
- "courses_title": "Cours à la une",
342
- "courses_button_title": "Plus de cours",
343
- "organizations_title": "Universités",
344
- "organizations_button_title": "Plus d'universités",
345
- "subjects_title": "Thématiques",
346
- "subjects_button_title": "Plus de thématiques",
347
- "persons_title": "Personnes",
348
- "persons_button_title": "Plus de personnes",
349
- "programs_title": "Parcours",
350
- "programs_button_title": "Plus de parcours",
351
- },
278
+ "blogposts_title": translate_message(str(code), "Last news"),
279
+ "blogposts_button_title": translate_message(str(code), "More news"),
280
+ "courses_title": translate_message(str(code), "Popular courses"),
281
+ "courses_button_title": translate_message(str(code), "More courses"),
282
+ "organizations_title": translate_message(str(code), "Universities"),
283
+ "organizations_button_title": translate_message(str(code), "More universities"),
284
+ "persons_title": translate_message(str(code), "Persons"),
285
+ "persons_button_title": translate_message(str(code), "More persons"),
286
+ "programs_title": translate_message(str(code), "Programs"),
287
+ "programs_button_title": translate_message(str(code), "More programs"),
288
+ "subjects_title": translate_message(str(code), "Subjects"),
289
+ "subjects_button_title": translate_message(str(code), "More subjects"),
290
+ }
291
+ for code, _ in languages
352
292
  }
353
293
  HOMEPAGE_CONTENT.update(getattr(settings, "RICHIE_DEMO_HOMEPAGE_CONTENT", {}))
354
294
 
355
295
  SINGLECOLUMN_CONTENT = {
356
- "en": {
357
- "banner_title": "Single column template sample",
358
- "banner_content": "It works! This is a single column page.",
359
- "banner_template": "richie/large_banner/hero-intro.html",
360
- "button_template_name": "button-caesura",
361
- "section_sample_title": "A sample section",
362
- "section_sample_button_title": "More!",
363
- "section_sample_template": "richie/section/section.html",
364
- },
365
- "fr": {
366
- "banner_title": "Exemple de template avec une colonne unique",
367
- "banner_content": "Ça marche ! Ceci est une page d'une colonne.",
296
+ str(code): {
297
+ "banner_title": translate_message(str(code), "Single column template sample"),
298
+ "banner_content": translate_message(
299
+ str(code), "It works! This is a single column page."
300
+ ),
368
301
  "banner_template": "richie/large_banner/hero-intro.html",
369
302
  "button_template_name": "button-caesura",
370
- "section_sample_title": "Une section d'exemple",
371
- "section_sample_button_title": "Plus !",
303
+ "section_sample_title": translate_message(str(code), "A sample section"),
304
+ "section_sample_button_title": translate_message(str(code), "More"),
372
305
  "section_sample_template": "richie/section/section.html",
373
- },
306
+ }
307
+ for code, _ in languages
374
308
  }
375
309
  SINGLECOLUMN_CONTENT.update(getattr(settings, "RICHIE_DEMO_SINGLECOLUMN_CONTENT", {}))
376
310
 
377
311
  FOOTER_CONTENT = {
378
- "en": [
379
- {"name": "About", "link": {"internal_link": "annex__about"}},
380
- {"name": "Sitemap", "link": {"internal_link": "annex__sitemap"}},
381
- {"name": "Style guide", "link": {"external_link": "/styleguide/"}},
312
+ str(code): [
382
313
  {
383
- "title": "Richie community",
384
- "items": [
385
- {
386
- "name": "Website",
387
- "link": {"external_link": "https://richie.education"},
388
- },
389
- {
390
- "name": "Github",
391
- "link": {"external_link": "https://github.com/openfun/richie"},
392
- },
393
- {
394
- "name": "Site factory",
395
- "link": {
396
- "external_link": "https://github.com/openfun/richie-site-factory"
397
- },
398
- },
399
- {
400
- "name": "Example site",
401
- "link": {"external_link": "https://www.fun-campus.fr"},
402
- },
403
- ],
314
+ "name": translate_message(str(code), "About"),
315
+ "link": {"internal_link": "annex__about"},
316
+ },
317
+ {
318
+ "name": translate_message(str(code), "Sitemap"),
319
+ "link": {"internal_link": "annex__sitemap"},
320
+ },
321
+ {
322
+ "name": translate_message(str(code), "Style guide"),
323
+ "link": {"external_link": "/styleguide/"},
404
324
  },
405
- ],
406
- "fr": [
407
- {"name": "A propos", "link": {"internal_link": "annex__about"}},
408
- {"name": "Plan du site", "link": {"internal_link": "annex__sitemap"}},
409
- {"name": "Style guide", "link": {"external_link": "/styleguide/"}},
410
325
  {
411
- "title": "Communauté Richie",
326
+ "title": translate_message(str(code), "Richie community"),
412
327
  "items": [
413
328
  {
414
- "name": "Site web",
329
+ "name": translate_message(str(code), "Website"),
415
330
  "link": {"external_link": "https://richie.education"},
416
331
  },
417
332
  {
@@ -419,24 +334,28 @@ FOOTER_CONTENT = {
419
334
  "link": {"external_link": "https://github.com/openfun/richie"},
420
335
  },
421
336
  {
422
- "name": "Usine à sites",
337
+ "name": translate_message(str(code), "Site factory"),
423
338
  "link": {
424
339
  "external_link": "https://github.com/openfun/richie-site-factory"
425
340
  },
426
341
  },
427
342
  {
428
- "name": "Site exemple",
343
+ "name": translate_message(str(code), "Example site"),
429
344
  "link": {"external_link": "https://www.fun-campus.fr"},
430
345
  },
431
346
  ],
432
347
  },
433
- ],
348
+ ]
349
+ for code, _ in languages
434
350
  }
435
351
  FOOTER_CONTENT.update(getattr(settings, "RICHIE_DEMO_FOOTER_CONTENT", {}))
436
352
 
437
353
  COURSE_CONTENT = {
438
- "en": {"partners_title": "Partners", "sponsors_title": "Sponsors"},
439
- "fr": {"partners_title": "Partenaires", "sponsors_title": "Sponsors"},
354
+ str(code): {
355
+ "partners_title": translate_message(str(code), "Partners"),
356
+ "sponsors_title": translate_message(str(code), "Sponsors"),
357
+ }
358
+ for code, _ in languages
440
359
  }
441
360
  COURSE_CONTENT.update(getattr(settings, "RICHIE_DEMO_COURSE_CONTENT", {}))
442
361
 
@@ -18,13 +18,12 @@ from cms.models import StaticPlaceholder
18
18
  from richie.apps.core.factories import create_text_plugin, image_getter
19
19
  from richie.apps.core.helpers import recursive_page_creation
20
20
  from richie.apps.courses import factories, models
21
+ from richie.apps.demo import defaults
22
+ from richie.apps.demo.helpers import create_categories
23
+ from richie.apps.demo.utils import pick_image
21
24
  from richie.plugins.glimpse import defaults as glimpse_defaults
22
25
  from richie.plugins.glimpse.factories import GlimpseFactory
23
26
 
24
- from ... import defaults
25
- from ...helpers import create_categories
26
- from ...utils import pick_image
27
-
28
27
  logger = logging.getLogger("richie.commands.demo.create_demo_site")
29
28
 
30
29
 
@@ -73,6 +72,9 @@ def create_demo_site():
73
72
  site.name = "Richie demonstration"
74
73
  site.save()
75
74
 
75
+ languages = getattr(settings, "LANGUAGES", ())
76
+ languages = [language_code for language_code, _ in languages]
77
+
76
78
  lms_endpoint = (
77
79
  getattr(settings, "RICHIE_LMS_BACKENDS", None)
78
80
  or [{"BASE_URL": defaults.DEFAULT_LMS_ENDPOINT}]
@@ -179,12 +181,14 @@ def create_demo_site():
179
181
 
180
182
  # Create organizations under the `Organizations` page
181
183
  organizations = []
184
+
182
185
  for i in range(defaults.NB_OBJECTS["organizations"]):
183
186
  # Randomly assign each organization to a partnership level category
187
+
184
188
  organizations.append(
185
189
  factories.OrganizationFactory(
186
190
  page_in_navigation=True,
187
- page_languages=["en", "fr"],
191
+ page_languages=languages,
188
192
  page_parent=pages_created["organizations"],
189
193
  fill_banner=pick_image("banner"),
190
194
  fill_categories=(
@@ -206,9 +210,10 @@ def create_demo_site():
206
210
  organizations,
207
211
  random.randint(1, defaults.NB_OBJECTS["person_organizations"]), # nosec
208
212
  )
213
+
209
214
  person = factories.PersonFactory(
210
215
  page_in_navigation=True,
211
- page_languages=["en", "fr"],
216
+ page_languages=languages,
212
217
  page_parent=pages_created["persons"],
213
218
  fill_categories=random.sample(
214
219
  subjects,
@@ -255,10 +260,9 @@ def create_demo_site():
255
260
  if licences
256
261
  else []
257
262
  )
258
-
259
263
  course = factories.CourseFactory(
260
264
  page_in_navigation=True,
261
- page_languages=["en", "fr"],
265
+ page_languages=languages,
262
266
  page_parent=pages_created["courses"],
263
267
  fill_licences=course_licences,
264
268
  fill_team=random.sample(
@@ -367,17 +371,12 @@ def create_demo_site():
367
371
 
368
372
  # Add a random number of course runs to the course
369
373
  nb_course_runs = get_number_of_course_runs()
370
- # pick a subset of languages for this course (otherwise all courses will have more or
371
- # less all the languages across their course runs!)
372
- languages_subset = random.sample(
373
- ["de", "en", "es", "fr", "it", "nl"], random.randint(1, 4) # nosec
374
- )
375
374
  # only half the courses have an enrollment count defined
376
375
  for i in range(nb_course_runs):
377
376
  course_run = factories.CourseRunFactory(
378
377
  __sequence=i,
379
378
  languages=random.sample(
380
- languages_subset, random.randint(1, len(languages_subset)) # nosec
379
+ languages, random.randint(1, len(languages)) # nosec
381
380
  ),
382
381
  direct_course=course,
383
382
  resource_link=f"{lms_endpoint}/courses/course-v1:edX+DemoX+Demo_Course/info",
@@ -400,7 +399,7 @@ def create_demo_site():
400
399
  for _i in range(defaults.NB_OBJECTS["blogposts"]):
401
400
  post = factories.BlogPostFactory.create(
402
401
  page_in_navigation=True,
403
- page_languages=["en", "fr"],
402
+ page_languages=languages,
404
403
  page_parent=pages_created["blogposts"],
405
404
  fill_cover=pick_image("cover"),
406
405
  fill_excerpt=True,
@@ -416,10 +415,11 @@ def create_demo_site():
416
415
 
417
416
  # Create programs under the `Programs` page
418
417
  programs = []
418
+
419
419
  for _i in range(defaults.NB_OBJECTS["programs"]):
420
420
  program = factories.ProgramFactory.create(
421
421
  page_in_navigation=True,
422
- page_languages=["en", "fr"],
422
+ page_languages=languages,
423
423
  page_parent=pages_created["programs"],
424
424
  fill_cover=pick_image("cover"),
425
425
  fill_excerpt=True,
@@ -8,7 +8,7 @@ from django.core.cache import caches
8
8
  from django.core.cache.backends.base import InvalidCacheBackendError
9
9
  from django.core.exceptions import ImproperlyConfigured
10
10
  from django.utils import translation
11
- from django.utils.translation import gettext as _
11
+ from django.utils.translation import gettext_lazy as _
12
12
 
13
13
  import arrow
14
14
  from cms.api import Page
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: richie
3
- Version: 3.1.3.dev8
3
+ Version: 3.1.3.dev11
4
4
  Summary: A CMS to build learning portals for open education
5
5
  Author-email: "Open FUN (France Université Numérique)" <fun.dev@fun-mooc.fr>
6
6
  License: MIT License
@@ -843,7 +843,7 @@ richie/apps/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
843
843
  richie/apps/core/admin.py,sha256=pbzLrvlzU32RTLDkCZ3BKU90nrRlMaQfvB5aOzup89s,2247
844
844
  richie/apps/core/cache.py,sha256=ruC2kg0JsZJ44lOggAfPGLQmJYzuhIkdBGag3LraiQ0,12245
845
845
  richie/apps/core/context_processors.py,sha256=jYleYykJhOJ1BNRjBfZHSdDT6E8aWpWUByNkn4bIAsw,9780
846
- richie/apps/core/defaults.py,sha256=E3GNwzXjnDSL-umVsCsGVPXbdN601dVD6_VLtJti30w,2586
846
+ richie/apps/core/defaults.py,sha256=q7WPE53h4lmv7RKNTCMSlK_YYZjoh_i7djILDGQ9Ba8,2779
847
847
  richie/apps/core/factories.py,sha256=fjEC2bnMLWY6AYvaUs4gq41aFGXzB86wCLB-_Mb-DZI,11377
848
848
  richie/apps/core/helpers.py,sha256=PsbWYgUbP215WEjj44lpqEeYb09dgJ-K_vYZwRxnlh0,5658
849
849
  richie/apps/core/models.py,sha256=dugl4pnEe9DImoxJVEU7lfhYrVBfgFkgt8i_VF7wje0,11275
@@ -933,7 +933,7 @@ richie/apps/core/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
933
933
  richie/apps/core/templatetags/feature_flags.py,sha256=eqgFmdYvEsQYboiXtsUY1IYOU1fsl-EwjEOcOj6KFFE,389
934
934
  richie/apps/core/templatetags/full_static_tags.py,sha256=t7bFniPf6KjglHN7_v9-apoBmqXdH8IyhluWeFP4S5Q,623
935
935
  richie/apps/core/templatetags/joanie.py,sha256=N3gZBMxdbsIQkLP0Ra1UjHDcPBAEyZjkJ8mQAL1Ahd4,437
936
- richie/apps/core/templatetags/language_name.py,sha256=vyKEHHhZXMGnLwn6GxWZuWxwzQmKXzyBOBxLZoNJlfI,619
936
+ richie/apps/core/templatetags/language_name.py,sha256=IpjzG91b632XmMsV64mRP06kYmHFwPd45AvIWgA_qq8,624
937
937
  richie/apps/core/templatetags/rfc_5646_locale.py,sha256=rgmub6cp_NtxjngpWUq0hnHvBFtBjFK7JWYGDGqSZJo,1026
938
938
  richie/apps/core/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
939
939
  richie/apps/core/tests/test_cache.py,sha256=WVW_F_SIpdG6TNsdqNJyehGZDiDLIleaGKE03bUlYtU,5841
@@ -1053,7 +1053,7 @@ richie/apps/courses/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
1053
1053
  richie/apps/courses/templatetags/category_tags.py,sha256=cSwWFtxiubAPgx9kTdDoOe3XOoPNfYirxA4xjAQjOk0,2147
1054
1054
  richie/apps/courses/templatetags/extra_tags.py,sha256=RGEnTj4M4IfUvnrZFc6Gob5Xjjt9ErnjEUru3kp0Fw0,13546
1055
1055
  richie/apps/demo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1056
- richie/apps/demo/defaults.py,sha256=nh3_SZ2eE9GBsjZR4ptWAJ0m489A8HBwr2ISkbTiwQ0,16574
1056
+ richie/apps/demo/defaults.py,sha256=LcwaIFlgfMidwOIdCzxkiU-__Tcv6dVTkOSk_gMhcJ8,13746
1057
1057
  richie/apps/demo/helpers.py,sha256=bg8RPWA-ZZme99pDswWHCpoPGZfWoFwe85fL7nv9FNA,2221
1058
1058
  richie/apps/demo/utils.py,sha256=P91d0Ex0COMFNEXYChVdibd5HXaAIEsqQgufml253LA,1446
1059
1059
  richie/apps/demo/fixtures/banner/banner1.jpg,sha256=I2zL-PU6I1_encvPajqW1tdYDYQ4zZSaDB1V2xuRjiw,99758
@@ -1110,7 +1110,7 @@ richie/apps/demo/fixtures/portrait/portrait-7.png,sha256=76tK5-lMED4mW8TN8JFRlOF
1110
1110
  richie/apps/demo/fixtures/portrait/portrait-8.png,sha256=BvA5je_9wioCgz56GxRIWX9XrcKQdGzCPi8xHvxF7O8,9370
1111
1111
  richie/apps/demo/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1112
1112
  richie/apps/demo/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1113
- richie/apps/demo/management/commands/create_demo_site.py,sha256=8GdmyHymtPVkN86zmvJ00Lx52F9P1wNNGOIQA_jEJY4,31642
1113
+ richie/apps/demo/management/commands/create_demo_site.py,sha256=0A3_zjKvGzxdRf_rMa-ZLtLOCFSta0AsFi1FIXfDBFk,31488
1114
1114
  richie/apps/search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1115
1115
  richie/apps/search/apps.py,sha256=npt71JLONMn4-BY5pJm8IAlAKZhKqzYC8sCOaCV9phY,1575
1116
1116
  richie/apps/search/cms_toolbars.py,sha256=z7n3QDSPIQks2NvmGRBWd58cbJq0lqEsBJmhK9eTKns,1272
@@ -1130,7 +1130,7 @@ richie/apps/search/fields/array.py,sha256=Ukfg-viKEZdk3NunS0lqCI2XDMs1lthsK78irS
1130
1130
  richie/apps/search/fields/datetimerange.py,sha256=Fj02Y4B0DVC4amHNaEa9cV7r5hhS0Qb5uQvOOU1NEEA,2500
1131
1131
  richie/apps/search/filter_definitions/__init__.py,sha256=HSRB17H9Y76Y7QpqBuxJZ5a06slxZz-J4h2_KHGY51k,627
1132
1132
  richie/apps/search/filter_definitions/base.py,sha256=YUk8nucv5Ceuvos5mepsyoKZaSrhHfgTwtnUI5x8evE,23513
1133
- richie/apps/search/filter_definitions/courses.py,sha256=RiQRChczwqROdk8CFVS6ENliUoWwpsuXSmBcpoq6pCc,20321
1133
+ richie/apps/search/filter_definitions/courses.py,sha256=FXu-gvMgljhI5my9uTvyyBZ7_JceBukr2x5ArpcgSkU,20326
1134
1134
  richie/apps/search/filter_definitions/helpers.py,sha256=Buyf0EJzYnlM3S8QrPWPhgRhKVL1098g_2J7aHhMYB0,838
1135
1135
  richie/apps/search/filter_definitions/mixins.py,sha256=EEcYVu426reDfeCaeVzNEzj7z40KjPB_yz3FthAIN-c,5669
1136
1136
  richie/apps/search/indexers/__init__.py,sha256=RcrvJGdyUBxcuWY9OnZ2G-G0YEcDb55n3_otj2JqWWg,655
@@ -2483,9 +2483,9 @@ richie/static/richie/js/build/99870.1973586060a86306e1e7.index.js,sha256=bX6Qwnj
2483
2483
  richie/static/richie/js/build/99895.1973586060a86306e1e7.index.js,sha256=N9A0976u752Fx2mP9x3Ag9XpI05rCDmUtNKeUgHlpKU,2570
2484
2484
  richie/static/richie/js/build/99953.1973586060a86306e1e7.index.js,sha256=OWoLPJnHrmvF3HBQPgXooAGo5E0yJpJ7QTFHFghJpI8,135
2485
2485
  richie/static/richie/js/build/index.js,sha256=PvnOnobN_2rGipe6B8KyE1v3CI3D9-3Kcb906C9J0Ws,1332827
2486
- richie-3.1.3.dev8.dist-info/licenses/LICENSE,sha256=5LKjFIE1kpKzBfR2iwq_RGHhHM5XawdlfZrcHTsCLpA,1079
2487
- richie-3.1.3.dev8.dist-info/METADATA,sha256=59QaQzAA61hizJmf809TnFwx9mSqTXy7imd4N1_lk_0,7033
2488
- richie-3.1.3.dev8.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
2489
- richie-3.1.3.dev8.dist-info/top_level.txt,sha256=WJvFAAHtUQ5T5MOuG6jRynDJG9kVfl4jtuf1qxIXND8,16
2490
- richie-3.1.3.dev8.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2491
- richie-3.1.3.dev8.dist-info/RECORD,,
2486
+ richie-3.1.3.dev11.dist-info/licenses/LICENSE,sha256=5LKjFIE1kpKzBfR2iwq_RGHhHM5XawdlfZrcHTsCLpA,1079
2487
+ richie-3.1.3.dev11.dist-info/METADATA,sha256=zJ8KxBZJa6QEC5sxn7ocC2nL_8D5t2o1HUCDBKQh-oo,7034
2488
+ richie-3.1.3.dev11.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
2489
+ richie-3.1.3.dev11.dist-info/top_level.txt,sha256=WJvFAAHtUQ5T5MOuG6jRynDJG9kVfl4jtuf1qxIXND8,16
2490
+ richie-3.1.3.dev11.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2491
+ richie-3.1.3.dev11.dist-info/RECORD,,