How to set an arabic locale in C++ using std::locale class?

问题描述 投票:0回答:0
#include<iostream>
int main(){
    std::locale::global(std::locale("en_GB.utf8")); 
}

根据我的阅读,这是在我的 C++ 程序中设置语言环境的方法。但是我应该将什么字符串传递给

std::locale()
构造函数/对象?如果我想要阿拉伯语语言环境?传递“ar_AR.utf8”是否有效? 意思是如果我写..

#include<iostream>
int main(){
    std::locale::global(std::locale("ar_AR.utf8")); 
}

这行得通吗?因为我的计划是最终写入文件。 请记住我当前的语言环境是“C” 我知道这是因为我写了..

#include<iostream>
int main(){
    std::cout << std::locale().name() << std::endl; 
}

并打印出

C
.

稍后我会这样尝试..

int main() {

std::locale::global(std::locale("ar_AR.utf8"));
std::cout << 'ت' << std::endl;

std::cin.get();


return 0;
}

它打印

?

c++ locale arabic windows-11
© www.soinside.com 2019 - 2024. All rights reserved.