Skip to content

Commit 56ee86c

Browse files
authored
Merge pull request #472 from dzcode-io/471-update-sitemap-with-localized-links-using-react-helmet
feat: update sitemap with localized links using react helmet
2 parents 3819573 + d0cdd1c commit 56ee86c

File tree

20 files changed

+304
-130
lines changed

20 files changed

+304
-130
lines changed

packages/ui/src/translation-factory/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export const translationFunctionFactory =
2525
dictionary: T,
2626
getLanguageCode: () => keyof T[keyof T],
2727
fallbackText?: string,
28-
): ((k: keyof T, r?: Record<string, string>) => string) =>
29-
(k, r = {}) => {
30-
const languageCode = getLanguageCode();
28+
): ((k: keyof T, r?: Record<string, string>, overrideLanguage?: keyof T[keyof T]) => string) =>
29+
(k, r = {}, overrideLanguage) => {
30+
const languageCode = overrideLanguage || getLanguageCode();
3131
return replace(dictionary, languageCode, fallbackText, k, r);
3232
};
3333

web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"markdown-to-jsx": "^7.1.0",
2727
"react": "^17.0.1",
2828
"react-dom": "^17.0.1",
29+
"react-helmet": "^6.1.0",
2930
"react-redux": "^7.2.6",
3031
"react-router-dom": "^5.2.0",
3132
"react-spring": "^8.0.27",
@@ -52,6 +53,7 @@
5253
"@types/mini-css-extract-plugin": "^2.0.1",
5354
"@types/react": "^17.0.0",
5455
"@types/react-dom": "^17.0.0",
56+
"@types/react-helmet": "^6.1.5",
5557
"@types/react-redux": "^7.1.20",
5658
"@types/react-router-dom": "^5.1.6",
5759
"@types/react-syntax-highlighter": "^13.5.0",

web/src/apps/main/components/t/dictionary.ts

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ export const dictionary = {
3939
ar: "حقوق النشر ©",
4040
},
4141

42-
"faq-title": { en: "Frequently Asked Questions", ar: "اللاسئلة الاكثر طرحا" },
42+
"faq-title": {
43+
en: "Frequently Asked Questions | DzCode i/o",
44+
ar: "اللاسئلة الاكثر طرحا | DzCode i / o",
45+
},
46+
"faq-description": {
47+
en: "Frequently asked questions about DzCode i/o",
48+
ar: "الأسئلة المتداولة حول DzCode i / o",
49+
},
50+
"faq-header-title": { en: "Frequently Asked Questions", ar: "اللاسئلة الاكثر طرحا" },
4351
"faq-need-help": {
4452
en: "Still need help? send us an email at ",
4553
ar: "هل ما زلت بحاجة إلى المساعدة؟ أرسل إلينا بريدًا إلكترونيًا على ",
@@ -188,6 +196,14 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu
188196
- ستحصل على مساهمات محتملة من مطورين آخرين ، مما سيجعل برنامجك في النهاية أفضل.
189197
`,
190198
},
199+
"landing-title": {
200+
en: "Algeria Codes | DzCode i/o",
201+
ar: "الجزائر تبرمج | DzCode i / o",
202+
},
203+
"landing-description": {
204+
en: "DzCode i/o is community of developers that tries to solve technical problems in Algeria via open-source software, this website helps you find, contribute and add to the list of open-source projects that solve some technical problems in Algerian.",
205+
ar: "DzCode i / o هو مجتمع من المطورين الذين يحاولون حل المشاكل التقنية في الجزائر عبر برمجيات مفتوحة المصدر ، وهذا الموقع يساعدك في العثور على ، والمساهمة والإضافة إلى قائمة المشاريع مفتوحة المصدر التي تحل بعض المشاكل التقنية في الجزائر.",
206+
},
191207
"landing-heading-title": {
192208
en: `<span class="CLASS"}>Open-Source</span> Algerian Comunity`,
193209
ar: `مجموعة جزائرية للبرامج <span class="CLASS"}>مفتوحة المصدر</span>`,
@@ -212,6 +228,14 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu
212228
en: "Meet the DzCode i/o mobile app and stay up-to-date with the state of Algerian open-source software on iOS and Android.",
213229
ar: "تعرف على تطبيق DzCode i / o للجوال وابق على اطلاع دائم بأحدث البرامج مفتوحة المصدر الجزائرية على iOS و Android.",
214230
},
231+
"team-title": {
232+
en: "Meet the team! | DzCode i/o",
233+
ar: "تعرّف على الفريق! | DzCode i / o",
234+
},
235+
"team-description": {
236+
en: "Meet and connect with all the contributors of all the listed projects on dzcode.io website",
237+
ar: "تعرف على جميع المساهمين في جميع المشاريع المدرجة وتواصل معهم على موقع dzcode.io الإلكتروني",
238+
},
215239
"team-error": {
216240
en: "Oops, an error occurred while loading the articles list, please try again...",
217241
ar: "عفوًا ، حدث خطأ أثناء تحميل قائمة المقالات ، يرجى المحاولة مرة أخرى ...",
@@ -220,7 +244,7 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu
220244
en: "Try Again",
221245
ar: "حاول مرة أخري",
222246
},
223-
"team-title": {
247+
"team-header-title": {
224248
en: "Get to know our team 💻",
225249
ar: "تعرف على فريقنا 💻",
226250
},
@@ -232,6 +256,14 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu
232256
en: "Repositories",
233257
ar: "مستودعات",
234258
},
259+
"projects-title": {
260+
en: "Browse a growing list of Algerian open-source projects | DzCode i/o",
261+
ar: "تصفح قائمة المشاريع الجزائرية مفتوحة المصدر | DzCode i / o",
262+
},
263+
"projects-description": {
264+
en: "Browse a growing list of Algerian open-source projects and be up-to-date with the state of open-source software in Algeria, you can also add your project to the list!",
265+
ar: "تصفح قائمة متزايدة من المشاريع الجزائرية مفتوحة المصدر وكن على اطلاع دائم بأحدث البرامج مفتوحة المصدر في الجزائر ، كما يمكنك إضافة مشروعك إلى القائمة!",
266+
},
235267
"projects-error": {
236268
en: "Oops, an error occurred while loading the projects list, please try again...",
237269
ar: "عفوًا ، حدث خطأ أثناء تحميل قائمة المشاريع ، يرجى المحاولة مرة أخرى ...",
@@ -240,14 +272,22 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu
240272
en: "Try Again",
241273
ar: "حاول مرة أخري",
242274
},
243-
"projects-title": {
275+
"projects-header-title": {
244276
en: "Open Source Projects",
245277
ar: "مشاريع مفتوحة المصدر",
246278
},
247279
"projects-card-cta-button": {
248280
en: "Go to code",
249281
ar: "إلى الكود",
250282
},
283+
"notfound-title": {
284+
en: "A broken link? | DzCode i/o",
285+
ar: "عنوان url معطل؟ | DzCode i / o",
286+
},
287+
"notfound-description": {
288+
en: "A broken link?",
289+
ar: "عنوان url معطل؟",
290+
},
251291
"notfound-subtitle": {
252292
en: `Finally someone saw the 404 page <a href="https://github.com/NurElHuda">Nour</a> built 😄`,
253293
ar: `أخيرًا شاهد شخص ما صفحة 404 التي أنشأتها <a href="https://github.com/NurElHuda">نور</a> 😄`,
@@ -256,6 +296,14 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu
256296
en: "Go Back Home",
257297
ar: "ارجع إلى الصفحة الرئيسية",
258298
},
299+
"contribute-title": {
300+
en: "Contribute to algerian open-source projects | DzCode i/o",
301+
ar: "ساهم في المشاريع الجزائرية مفتوحة المصدر | DzCode i / o",
302+
},
303+
"contribute-description": {
304+
en: "Browse and contribute to Algerian open-source projects",
305+
ar: "تصفح وساهم في مشاريع جزائرية مفتوحة المصدر",
306+
},
259307
"contribute-filter-projects": {
260308
en: "Project",
261309
ar: "المشروع",
@@ -280,4 +328,20 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu
280328
en: "y|mo|d|h|min|Just now",
281329
ar: " عام| شهر| يوم| ساعة| دقيقة| الآن",
282330
},
331+
"articles-title": {
332+
en: "Read and discuss articles written by algerian developers | DzCode i/o",
333+
ar: "اقرأ وناقش المقالات التي كتبها المطورون الجزائريون | DzCode i / o",
334+
},
335+
"articles-description": {
336+
en: "Browse, read or modify a growing list of articles written by Algerian developers, or Add your own article to the list!",
337+
ar: "تصفح أو اقرأ أو عدل قائمة متزايدة من المقالات التي كتبها مطورون جزائريون ، أو أضف مقالك الخاص إلى القائمة!",
338+
},
339+
"learn-title": {
340+
en: "Learn about software development through open-source | DzCode i/o",
341+
ar: "تعرف على البرمجة من خلال البرامج مفتوحة المصدر | DzCode i / o",
342+
},
343+
"learn-description": {
344+
en: "Learn and share your knowledge with other Algerian developers!",
345+
ar: "تعلم وشارك معرفتك مع مطورين جزائريين آخرين!",
346+
},
283347
};

web/src/apps/main/entry/app.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import { allLanguages, LanguageEntity } from "@dzcode.io/models/dist/language";
44
import { ErrorBoundary } from "@dzcode.io/ui/dist/error-boundary";
55
import Container from "@material-ui/core/Container";
66
import { ComponentType, FC, lazy, Suspense, useEffect } from "react";
7+
import { Helmet } from "react-helmet";
78
import { useDispatch, useSelector } from "react-redux";
89
import { Route, RouteProps, Switch, useLocation, useRouteMatch } from "react-router-dom";
910
import { Footer } from "src/apps/main/components/footer";
1011
import { Navbar } from "src/apps/main/components/navbar";
12+
import { t } from "src/apps/main/components/t";
1113
import { Theme } from "src/apps/main/components/theme";
1214
import { getEnv } from "src/common/utils";
1315
import { urlLanguageRegEx } from "src/common/utils/language";
@@ -83,6 +85,9 @@ export const App: FC = () => {
8385
return (
8486
<Theme>
8587
<ErrorBoundary>
88+
<Helmet>
89+
<title>{t("landing-title")}</title>
90+
</Helmet>
8691
<div
8792
style={{
8893
display: "flex",

0 commit comments

Comments
 (0)