\documentclass[12pt]{scrartcl}
% \usepackage{silence}
% \WarningFilter{latex}{Command \InputIfFileExists}
%%% For accessing system, OTF and TTF fonts
%%% (would have been loaded by polylossia anyway)
\usepackage{fontspec}
% \usepackage{xunicode} %% loading this first to avoid clash with bidi/arabic
%%% For language switching
\usepackage[main=english,bidi=default]{babel}
%%% For the xelatex (and other LaTeX friends) logos
\usepackage{hologo}
\usepackage[hyphens]{url}
%% imoprt other languages
\babelprovide[import]{arabic}
\babelprovide[import]{hindi}
\babelprovide[import]{sanskrit}
\babelprovide[import]{greek}
\babelprovide[import]{thai}
% Main serif font for English (Latin alphabet) text
\babelfont{rm}[Language=Default]{Noto Serif}
\babelfont{sf}[Language=Default]{Noto Sans}
\babelfont{tt}[Language=Default]{Noto Mono}
% define fonts for other languages
\babelfont[arabic]{rm}[Language=Default]{Noto Naskh Arabic}
\babelfont[arabic]{sf}[Language=Default]{Noto Kufi Arabic}
\babelfont[*devanagari]{rm}[Language=Default]{Noto Serif Devanagari}
\babelfont[*devanagari]{sf}[Language=Default]{Noto Sans Devanagari}
% \babelfont[greek]{rm}[Language=Default]{GFS Artemisia}
\babelfont[thai]{rm}[Language=Default]{Noto Serif Thai}
\babelfont[thai]{sf}[Language=Default]{Noto Sans Thai}
%%% CJK needs a different treatment
\usepackage[space]{xeCJK}
%%% Assuming Chinese is the main CJK language...
\setCJKmainfont{Noto Serif CJK SC}
\setCJKsansfont{Noto Sans CJK SC}
\setCJKmonofont{Noto Sans CJK SC}
%%% Define fonts for Japanese and Korean
\newCJKfontfamily\japanesefont{Noto Serif CJK JP}
%%% You can also upload your own font files
% \newCJKfontfamily\koreanfont{[UnGraphic.ttf]}
%%% ...or go along with a font available on the server
\newCJKfontfamily\koreanfont{Noto Serif CJK KR}
\title{How to Write Multilingual Text with Different Scripts in \LaTeX{} using Babel}
\author{Lim Lian Tze}
\date{}
\begin{document}
\maketitle
This is a mainly English document which contains other languages. Here we use \texttt{polyglossia} and \texttt{fontspec}.
You'll need to use \hologo{XeLaTeX} or \hologo{LuaLaTeX} to compile this document. You can configure your Overleaf project to be compiled with \hologo{XeLaTeX} by clicking on the Overleaf menu button above the file list panel, and set \texttt{Compiler} to \texttt{XeLaTeX} or \texttt{LuaLaTeX}.
\section{Arabic}
Here's some Arabic text:
%% Arabic lorem ipsum text from http://generator.lorem-ipsum.info/_arabic
%% Note capital "A"rabic
\begin{otherlanguage}{arabic}
بعد هامش وإقامة المتحدة و, أم السادس وبالرغم فقد. بعد أن صفحة شمال بداية, أسر حصدت تزامناً ما. ٣٠ نقطة المحيط بمحاولة مكن, مع شمال يتبقّ تحت. خلاف أكثر دون من, الأرض أعلنت فرنسية ٣٠ على.
\end{otherlanguage}
\section{Hindi}
Here's some Hindi:
%% Hindi lorem ipsum text from http://generator.lorem-ipsum.info/_hindi
\begin{otherlanguage}{hindi}
जैसी जिम्मे ऎसाजीस दिनांक विवरण जनित बाटते भारतीय विचरविमर्श बढाता विषय वर्णित पुष्टिकर्ता किया बनाने ज्यादा लचकनहि पुर्णता वातावरण व्याख्या संस्क्रुति होभर चिदंश होसके अधिकार उसीएक् बीसबतेबोध अपनि हमेहो। संस्थान उपलब्धता बनाकर करने अपने प्राण समस्याओ बीसबतेबोध उपयोगकर्ता आशाआपस असक्षम बनाति देते बनाने सिद्धांत बीसबतेबोध ढांचामात्रुभाषा कर्य
\end{otherlanguage}
\section{Sanskrit}
And here's some Sanskrit:
\begin{otherlanguage}{sanskrit}
सर्वे मानवाः स्वतन्त्राः समुत्पन्नाः वर्तन्ते अपि च, गौरवदृशा अधिकारदृशा च समानाः एव वर्तन्ते।
\end{otherlanguage}
\section{CJK}
Here's some Chinese:
人有悲欢离合,月有阴晴圆缺。此事古难全,但愿人长久,千里共婵娟。
Japanese:
{\japanesefont 露の世は、露の世ながら、さりながら。}
Korean:
{\koreanfont 피어나는 그들에게 바로 있음으로써 우리는 든 설레는 스며들어 칼이다}
\section{Greek}
Here's some Greek:
%% Lorem ipsum from http://generator.lorem-ipsum.info/_greek
\begin{otherlanguage}{greek}
Οδιο διστα ιμπεδιτ φιμ ει, αδ φελ αβχορρεανθ ελωκυενθιαμ, εξ εσε εξερσι γυβεργρεν ηας. Ατ μει σολετ σριπτορεμ. Ιυς αλια λαβωρε θε. Σιθ κυωτ νυσκυαμ ιρασυνδια αν, ωμνιυμ ελιγενδι ιν πρι. Παρτεμ φερθερεμ συσιπιαντυρ εξ ιυς, ναμ τωλλιτ ιυφαρεθ αδφερσαριυμ εα, πρω πρωπριαε σαεφολα ιδ. Ατ πρι δολορ νυσκυαμ.
\end{otherlanguage}
\section{Thai}
Here's some Thai:
%% Lorem ipsum from http://lorem.in.th/
\begin{otherlanguage}{thai}
คอรัปชันจุ๊ยโปรดิวเซอร์ สถาปัตย์จ๊าบ แจ็กพ็อต ม้าหินอ่อน ซากุระคันถธุระ ฟีดสตาร์ท งี้ บอยคอตอิ่มแปร้สังโฆคำสาปแฟนซี ศิลปวัฒนธรรมไฟลท์จิ๊กโก๋กับดัก เจลพล็อตมาม่าซากุระดีลเลอร์ ซีนดัมพ์ แฮปปี้ เอ๊าะอุรังคธาตุซิม ฟินิกซ์เทรลเล่อร์อวอร์ด แคนยอนสมาพันธ์ ครัวซองฮัมอาข่าเอ็กซ์เพรส
\end{otherlanguage}
\section{How Do I Know What Fonts are Available on Overleaf?}
You can check the list here: \url{https://www.overleaf.com/help/193}
Tip: We have the Noto fonts!!
\end{document}