-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanner.html
60 lines (48 loc) · 6.19 KB
/
banner.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QXDW878QLX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QXDW878QLX');
</script>
<div class="alert alert-info alert-dismissible">
<!-- <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Need help learning R?</strong> Enroll in Applied Epi's <a href="https://www.appliedepi.org/live/"
class="alert-link">intro R course</a>, try our <a href="https://www.appliedepi.org/tutorial/"
class="alert-link">free R tutorials</a>, post in our <a href="https://community.appliedepi.org/"
class="alert-link">Community Q&A forum</a>, or ask about our <a href="mailto:[email protected]"
class="alert-link">R Help Desk service</a>. -->
</div>
<script>
// Function to extract the last two characters from the URL path
function getLanguageFromURL() {
const path = window.location.pathname.split('/');
if (path.length > 1) {
return path[1]; // Assume the language code is the second segment
}
return '';
}
const language = getLanguageFromURL();
const supportedLanguages = ['fr', 'es', 'vn', 'jp', 'pt', 'tr', 'ru', 'en'];
const defaultLanguage = 'en';
const isSupportedLanguage = supportedLanguages.includes(language);
// Translations for the content
const translations = {
en: '<strong>Need help learning R?</strong> Enroll in Applied Epi\'s <a href="https://www.appliedepi.org/live/" class="alert-link">intro R course</a>, try our <a href="https://www.appliedepi.org/tutorial/" class="alert-link">free R tutorials</a>, post in our <a href="https://community.appliedepi.org/" class="alert-link">Community Q&A forum</a>, or ask about our <a href="mailto:[email protected]" class="alert-link">R Help Desk service</a>.',
fr: '<strong>Besoin d\'aide pour apprendre R ?</strong> Inscrivez-vous au <a href="https://www.appliedepi.org/live/" class="alert-link">cours d\'introduction à R</a> d\'Applied Epi, essayez nos <a href="https://www.appliedepi.org/tutorial/" class="alert-link">tutoriels R gratuits</a>, postez dans notre forum de <a href="https://community.appliedepi.org/" class="alert-link">questions-réponses communautaires</a>, ou demandez-nous des informations sur <a href="mailto:[email protected]" class="alert-link"> notre service d\'assistance R</a>.',
es: '<strong>¿Necesitas ayuda para aprender R?</strong> Inscríbete en el <a href="https://www.appliedepi.org/live/" class="alert-link">Curso de introducción a R</a> de Applied Epi, prueba nuestros <a href="https://www.appliedepi.org/tutorial/" class="alert-link">Tutoriales gratuitos de R</a>, escribe en nuestro <a href="https://community.appliedepi.org/" class="alert-link">Foro de preguntas y respuestas,</a> o pregunta por nuestra <a href="mailto:[email protected]" class="alert-link">Asistencia técnica para R</a>.',
vn: '<strong>Bạn cần giúp đỡ trong việc học R?</strong> Hãy đăng ký khóa học R cơ bản của Applied Epi tại <a href="https://www.appliedepi.org/live/" class="alert-link">đây</a>, hoặc thử các <a href="https://www.appliedepi.org/tutorial/" class="alert-link">hướng dẫn R miễn phí</a>, đăng bài trong <a href="https://community.appliedepi.org/" class="alert-link">diễn đàn cộng đồng</a>, hoặc gửi câu hỏi tới <a href="mailto:[email protected]" class="alert-link">dịch vụ Trợ giúp R</a> của chúng tôi.',
jp: '<strong>Rの学習について助けが必要ですか?</strong>Applied Epiの<a href="https://www.appliedepi.org/live/" class="alert-link">R入門コース</a>に登録するか、<a href="https://www.appliedepi.org/tutorial/" class="alert-link">無料Rチュートリアル</a>を試すか、<a href="https://community.appliedepi.org/" class="alert-link">コミュニティQ&Aフォーラム</a>に投稿するか、<a href="mailto:[email protected]" class="alert-link">Rヘルプデスクサービス</a>についてお問い合わせください。',
pt: '<strong>Você precisa de ajuda para aprender R??</strong> Inscreva-se no curso de <a href="https://www.appliedepi.org/live/" class="alert-link">introdução ao R da Applied Epi</a>, experimente nossos <a href="https://www.appliedepi.org/tutorial/" class="alert-link">tutoriais gratuitos sobre o R</a>, publique em nosso <a href="https://community.appliedepi.org/" class="alert-link">fórum de perguntas e respostas</a>, ou solicite nosso <a href="mailto:[email protected]" class="alert-link">suporte ao R</a>.',
tr: '<strong>R öğrenmekte yardıma mı ihtiyacınız var?</strong> Applied Epi\'\nin <a href="https://www.appliedepi.org/live/" class="alert-link">R\'ye giriş kursuna</a> kaydolun, <a href="https://www.appliedepi.org/tutorial/" class="alert-link">ücretsiz R derslerimizi</a> deneyin, <a href="https://community.appliedepi.org/" class="alert-link">Topluluk Q&A forumunda</a> soru paylaşın, ya da <a href="mailto:[email protected]" class="alert-link">R Yardım Masası hizmetimiz</a> hakkında sorun.',
ru: '<strong>Нужна помощь в изучении R?</strong> Запишитесь на <a href="https://www.appliedepi.org/live/" class="alert-link">вводный курс по R</a> от Applied Epi, попробуйте наши <a href="https://www.appliedepi.org/tutorial/" class="alert-link">бесплатные учебные материалы по R</a>, задайте вопрос в нашем <a href="https://community.appliedepi.org/" class="alert-link">форуме вопросов и ответов сообщества</a>, или спросите о нашей услуге <a href="mailto:[email protected]" class="alert-link">Службы поддержки по R</a>.'
};
// Default to English if the detected language is not supported
const contentToDisplay = translations[isSupportedLanguage ? language : defaultLanguage];
// Select the element where the content should be displayed
const alertElement = document.querySelector('.alert');
if (alertElement) {
alertElement.innerHTML = contentToDisplay;
alertElement.style.display = 'block'; // Make sure to display the element
}
</script>