从序列化切换语言 [英] Language Switching from Serialization

查看:74
本文介绍了从序列化切换语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在项目中使用的是 Microsoft Vissual C ++ 6.0 SP6 MFC . &我创建了一个具有文档/视图支持的简单 SDI 项目. &我想使用CArchive序列化类,只需单击一下即可从菜单切换界面语言(例如,EN/FR).并保存最新使用的语言界面,以供下次应用程序重新启动.

这个怎么做? :confused:请帮我:sigh:

NB:所有应用短语都是CString class type

Hi guys, I am using Microsoft Vissual C++ 6.0 SP6 MFC for my projects. & I created a simple SDI with Document/View support project. & I want to make it possible to switch the interface language (EN/FR for example) from the menu in just one click using the CArchive serialization class. and also save the latest used language interface for the next application restart.

How to do this? :confused: Help me please :sigh:

NB: All the application phrases are CString class type

推荐答案

只需实现以下类:):
Just implement the following class :) :
class CYouMainFrame;

class CInterfacePhrases
 : public CMapStringToString /*PhraseKey <-> PhraseValue*/
{
  DECLARE_SERIAL(CInterfacePhrases);

private:
  UINT m_uiLanguage;

protected:
  CInterfacePhrases();

public:
  CInterfacePhrases(UINT uiLanguage);
  virtual ~CInterfacePhrases();

  bool Exchange(CYouMainFrame* pcFrame, bool bGet /*or Set*/);

  void GetStorageFileName(CString& cszFileName);
  virtual void Serialize(CArchive& ar);
};


tomay3000写道:
tomay3000 wrote:

我希望可以切换界面语言(ZH /FR),只需使用CArchive序列化类单击菜单即可.

I want to make it possible to switch the interface language (EN/FR for example) from the menu in just one click using the CArchive serialization class.



动态切换用户界面语言有多种方法(例如,您可以使用XML文件存储本地化的字符串).我不认为CArchive类对此起主要作用.
:)



There are several ways for dynamically switching user interface language (you may use, for instance, XML files to store localized strings). I don''t think the CArchive class has a major role in that.
:)


这篇关于从序列化切换语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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