#include <locale>
int main(){
    std::locale::global(std::locale("en_GB.utf8"));
}
From my reading this is the way to set a locale in my C++ program. But what string should I pass to the std::locale() constructor/object? if I want Arabic locale? Does passing "ar_AR.utf8" will work?
Meaning if I write:
#include <locale>
int main(){
    std::locale::global(std::locale("ar_AR.utf8"));
}
Will this work? Because my plan is that to eventually write to a file. Bear in mind my current locale is "C".
I know this because I wrote
#include <iostream>
#include <locale>
int main(){
    std::cout << std::locale().name() << std::endl;
}
and it prints C.
#include <iostream>
#include <locale>
int main(){
    std::locale::global(std::locale("ar_AR.utf8"));
    std::cout << std::locale().name()<< std::endl;
}
It prints ar_AR.utf8.
Later I try like this.
#include <iostream>
#include <locale>
int main() {
    std::locale::global(std::locale("ar_AR.utf8"));
    std::cout << 'ت' << std::endl;
    std::cin.get();
}
It prints ?.
#include <iostream>
#include <locale>
int main() {
    std::locale::global(std::locale("ar_AR.utf8"));
    std::cout << L"ت" << std::endl;
    std::cin.get();
}
Using the string literal L"ت" and it prints a number 00007FF634AA0310.
#include <iostream>
#include <locale>
int main() {
    std::locale::global(std::locale("ar_AR.utf8"));
    std::cout << "ت" << std::endl;
    std::cin.get();
}
If not wide string without L it prints ?.
#include <iostream>
#include <locale>
int main() {
    std::locale::global(std::locale("ar_AR.utf8"));
    std::cout << 2.5 << std::endl;
    std::cin.get();
}
Tried to print 2.5 and 2.5 was printed.
 
    