本地化 - 消息 [英] Localization - Messages

查看:82
本文介绍了本地化 - 消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用std :: locale将消息本地化到我的应用程序。

I'm trying to use std::locale to localization messages to my application.

当我使用时代码:

#include <iostream>
#include <locale>

int main()
{
  //char currentPath[255] = { '\0' };
  //getcwd(&currentPath, sizeof(currentPath));

  //std::locale loc(""); //linux
  std::locale loc("Portuguese_brazil"); //windows
  
  std::cout.imbue(loc);

  const std::messages<char>& facet = std::use_facet<std::messages<char>>(loc);


  //std::messages<char>::catalog cat = facet.open("helloworld", loc, currentPath); //linux
  std::messages<char>::catalog cat = facet.open("helloworld", loc); // windows, nao tem o terceiro parametro que especifica o diretorio de locale

  if(cat < 0 )
  {
    std::cout << "Could not open pt_BR \"helloworld\" message catalog\n";
  }
  else
  {
    std::cout << "Hello World -> : " << facet.get(cat, 0, 0, "Hello World\n");
  }
                
  facet.close(cat);
}

facet.open函数失败。

The facet.open function fail.

在linux上我有一个参数来指定目录消息路径。

At linux I has an argument to specify the catalog messages path.

在Windows中如何指定目录消息的路径?

At Windows how specify the path for catalog messages ?

是否有默认路径?

谢谢

推荐答案

很抱歉,如果这不是您所说的,但我认为你需要使用

消息编译器
编译消息资源。
Sorry if this isn't what you're talking about but I think you need to use the Message Compiler to compile your messages resource.


这篇关于本地化 - 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆