{"id":2865,"date":"2015-09-23T21:15:58","date_gmt":"2015-09-23T13:15:58","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=2865"},"modified":"2015-09-24T09:30:51","modified_gmt":"2015-09-24T01:30:51","slug":"qlang-%e5%a6%82%e4%bd%95%e8%ae%a9%e4%bd%a0%e7%9a%84%e7%a8%8b%e5%ba%8f%e6%94%af%e6%8c%81%e5%a4%9a%e8%af%ad%e8%a8%80","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=2865","title":{"rendered":"[QLang] \u5982\u4f55\u8ba9\u4f60\u7684\u7a0b\u5e8f\u652f\u6301\u591a\u8bed\u8a00"},"content":{"rendered":"<p>QLang \u7684\u591a\u8bed\u8a00\u652f\u6301\u4f7f\u7528\u8d77\u6765\u4e00\u5982\u65e2\u5f80\u7684\u7b80\u5355\u3002\u8981\u4f7f\u4f60\u7684\u7a0b\u5e8f\u652f\u6301\u591a\u8bed\u8a00\uff0c\u4f60\u8ba4\u4e3a\u9700\u8981\u51e0\u4e2a\u6b65\u9aa4\uff1f\u53ea\u9700\u8981\u4e00\u4e2a\uff1a\u5728\u4f60\u7684\u9879\u76ee\u4e2d\u52a0\u5165\u5bf9 qlang \u7684\u5f15\u7528\u3002\u771f\u7684\u6ca1\u4e86\u5417\uff1f\u6ca1\u4e86\uff0c\u4f60\u7684\u7a0b\u5e8f\u73b0\u5728\u5df2\u7ecf\u652f\u6301\u591a\u8bed\u8a00\uff0c\u5269\u4e0b\u7684\u4e8b\u60c5\u5c31\u662f\u751f\u6210\u8bed\u8a00\u5b57\u5178\u5e76\u7ffb\u8bd1\u7684\u95ee\u9898\u4e86\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u751f\u6210\u9700\u8981\u7ffb\u8bd1\u7684\u5b57\u5178\u9879\u76ee\uff1b<\/p>\n<p>\u76ee\u524d\u7248\u672c\u7684QLang\u8fd8\u6ca1\u6709\u5b8c\u5168\u81ea\u52a8\u5316\u7684\u591a\u8bed\u8a00\u5b57\u5178\u751f\u6210\u7ffb\u8bd1\u5de5\u5177\uff0c\u6240\u4ee5\u8fd9\u91cc\u9700\u8981\u5927\u5bb6\u6682\u65f6\u91c7\u7528\u4ee5\u4e0b\u529e\u6cd5\uff1a<\/p>\n<ul>\n<li>\u6267\u884c\u4e0b\u9762\u7684\u4ee3\u7801\u5c06\u8bed\u8a00\u4e3a\u7a97\u4f53\u672c\u8eab\u7684\u539f\u59cb\u8bed\u8a00\uff1a\n<pre class=\"lang:delphi decode:true\">LangManager.ActiveIndex:=0;<\/pre>\n<p>&nbsp;<\/li>\n<li>\u5bf9\u4e8e\u8981\u7ffb\u8bd1\u7684\u7a97\u4f53\uff0c\u4f7f\u7528 LangManager.FromComponent(LangManager.ActiveLang,\u7a97\u4f53\u5b9e\u4f8b) \u6765\u5c06\u5f53\u524d\u8981\u7ffb\u8bd1\u7684\u7a97\u4f53\u7ec4\u4ef6\u5185\u5bb9\u4fdd\u5b58\u5230\u9ed8\u8ba4\u8bed\u8a00\u5b57\u5178:\n<pre class=\"lang:delphi decode:true \">var\r\n  F:TForm1;\r\nbegin\r\nF:=TForm1.Create(Application);\r\nLangManager.FromComponent(LangManager.ActiveLanguage,F);\r\nF.Free;\r\nend;<\/pre>\n<p>\u91cd\u590d\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u5c06\u5404\u4e2a\u7a97\u4f53\u7684\u7ec4\u4ef6\u5185\u5bb9\u4fdd\u5b58\u5230\u9ed8\u8ba4\u7684\u8bed\u8a00\u5b57\u5178\u3002<\/li>\n<li>\u8c03\u7528 LangManager.ActiveLanguage.SaveToFile \u5c06\u751f\u6210\u7684\u6a21\u677f\u6570\u636e\u4fdd\u5b58\u4e3a\u6269\u5c55\u540d\u4e3a .qlang \u7684\u8bed\u8a00\u6587\u4ef6\uff1b<\/li>\n<li>\u5bf9\u4e8e\u7a0b\u5e8f\u4e2d\u7684\u5b57\u7b26\u4e32\u5e38\u91cf\u548c EXE \u8d44\u6e90\u4e2d\uff0c\u5219\u5e94\u901a\u8fc7\u540e\u671f\u4f7f\u7528 MsgPackView \u6765\u7f16\u8f91\u751f\u6210\u7684\u8bed\u8a00\u6587\u4ef6\u3002<br \/>\n<a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/09\/msgpackview.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2867\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/09\/msgpackview.jpg\" alt=\"msgpackview\" width=\"614\" height=\"441\" srcset=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/09\/msgpackview.jpg 614w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/09\/msgpackview-300x215.jpg 300w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/a>\uff081\uff09\u3001\u4fee\u6539 Id \u7684\u503c\u4e3a\u8bed\u8a00\u5bf9\u5e94\u7684\u533a\u57df\u4ee3\u7801\uff0c\u4e2d\u6587\u4e3a 2052\uff0c\u5177\u4f53\u53ef\u4ee5\u5728\u5de5\u7a0b\u7684 Project-&gt;Options-&gt;Version Info \u91cc\u627e Locale Id\uff0c\u5c06\u5176\u8f6c\u6362\u4e3a10\u8fdb\u5236\u5373\u53ef\u3002Name\u4e3a\u5bf9\u5e94\u7684\u8bed\u8a00\u540d\u79f0\u3002<br \/>\n\uff082\uff09\u3001\u5728 Constants \u4e0b\u53f3\u952e\u52a0\u5165\u5b57\u7b26\u4e32\u5e38\u91cf\u7684\u7ffb\u8bd1\u5b9a\u4e49\uff0c\u540d\u79f0\u4e3a\u539f\u59cb\u5b57\u7b26\u4e32\uff0c\u503c\u4e3a\u7ffb\u8bd1\u503c\uff0c\u5982\u4e0a\u56fe\u52a0\u5165\u4e86\u4e24\u4e2a\u5bf9\u5e94\u7684\u9879\u76ee\uff1b<br \/>\n\uff083\uff09\u3001\u5728 Resources \u91cc\u52a0\u5165\u8d44\u6e90\u9879\u76ee\u5b57\u7b26\u4e32\u7ffb\u8bd1\u5b9a\u4e49\uff0c\u540d\u79f0\u4e3a\u539f\u59cb\u5b57\u7b26\u4e32\uff0c\u503c\u4e3a\u7ffb\u8bd1\u503c\uff1b<br \/>\n\uff084\uff09\u3001\u5c06\u6587\u4ef6\u4fdd\u5b58\u5230\u7a0b\u5e8f\u53ef\u6267\u884c\u6587\u4ef6\u76ee\u5f55\u4e0b\uff0c\u540d\u79f0\u4efb\u610f\uff0c\u6269\u5c55\u4e3a .qlang \u5373\u53ef\u3002<br \/>\n\uff085\uff09\u3001\u4fee\u6539\u533a\u57df\u4ee3\u7801\u3001\u540d\u79f0\u53ca\u65b0\u8bed\u8a00\u5bf9\u5e94\u7684\u503c\uff0c\u53e6\u5b58\u4e3a\u65b0\u7684 .qlang \u6587\u4ef6\u3002<\/li>\n<li>\u542f\u52a8\u7a0b\u5e8f\uff0c\u4f60\u7684\u7a0b\u5e8f\u73b0\u5728\u5c31\u4f1a\u81ea\u52a8\u5339\u914d\u5f53\u524d\u64cd\u4f5c\u7cfb\u7edf\u7684\u8bed\u8a00\uff08\u5982\u679c\u6709\u5bf9\u5e94\u7684\u8bed\u8a00\uff09\u3002\u5982\u679c\u8981\u4eba\u5de5\u8c03\u6574\u8bed\u8a00\uff0c\u7a0b\u5e8f\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2aComboBox\u6216\u7c7b\u4f3c\u7684\u63a7\u4ef6\uff0c\u7136\u540e\u8c03\u7528 LangManager.EnumLanguages \u6765\u679a\u4e3e\u53ef\u7528\u7684\u8bed\u8a00\u3002\u7136\u540e\u6839\u636e\u901a\u8fc7\u8bbe\u7f6e LangManager.ActiveIndex \u6765\u9009\u62e9\u76f8\u5e94\u7684\u8bed\u8a00\u3002<\/li>\n<\/ul>\n<p>QLang \u5c06\u6765\u4f1a\u63d0\u4f9b\u4e13\u7528\u7684\u8bed\u8a00\u7ffb\u8bd1\u5de5\u5177\uff0c\u6765\u7b80\u5316\u4e0a\u8ff0\u64cd\u4f5c\u3002\u4e0b\u9762\u8bf4\u4e00\u4e0b\u7a0b\u5e8f\u4e2d\u5982\u4f55\u4f7f\u7528\u4e00\u4e9b\u5e38\u91cf\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528 resourestring \u5b9a\u4e49\u7684\u8d44\u6e90\u5b57\u7b26\u4e32\u7528\u6cd5\u4e0d\u53d8\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u53d8\u52a8\uff1b<\/li>\n<li>\u5e38\u91cf\u5b57\u7b26\u4e32\u4f7f\u7528 _(\u5e38\u91cf\u5b57\u7b26\u4e32) \u7684\u65b9\u5f0f\u6765\u66ff\u6362\uff0c\u8fd9\u6837\u5728\u8fd0\u884c\u65f6\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u6b63\u786e\u7684\u7ffb\u8bd1\u3002\u4ee5 _(\u5e38\u91cf\u5b57\u7b26\u4e32) \u7ffb\u8bd1\u7684\u5185\u5bb9\uff0c\u4f1a\u4f18\u5148\u53d6 QLang \u8bed\u8a00\u6587\u4ef6\u4e2d\u7684 Constants \u5c0f\u8282\u7684\u7ffb\u8bd1\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u5219\u4f1a\u81ea\u52a8\u67e5\u627e Resources \u5c0f\u8282\u7684\u7ffb\u8bd1\u3002\u5982\u679c\u8981\u660e\u786e\u53ea\u4f7f\u7528 Constants \u5c0f\u8282\u7684\u7ffb\u8bd1\uff0c\u5219\u4f7f\u7528 _const(\u5e38\u91cf\u5b57\u7b26\u4e32) \u6765\u4ee3\u66ff _(\u5e38\u91cf\u5b57\u7b26\u4e32)\u3002<\/li>\n<\/ul>\n<p>\u5bf9\u4e8e\u53ef\u6267\u884c\u7a0b\u5e8f\u4e2d\u7684\u5b57\u7b26\u4e32\u8d44\u6e90\uff0cQLang \u505a\u4e86\u4e00\u4e2a\u4f18\u5316\u7ea7\u5904\u7406\uff0c\u901a\u8fc7 @\u8d44\u6e90ID \u547d\u540d\u7684\u7ffb\u8bd1\u4f1a\u88ab\u4f18\u5148\u91c7\u7528\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u5219\u4f1a\u67e5\u627e\u5b57\u7b26\u4e32\u5185\u5bb9\u76f8\u5339\u914d\u7684\u7ffb\u8bd1\u3002\u8fd9\u6837\uff0c\u53ef\u4ee5\u65b9\u4fbf\u540c\u6837\u539f\u6587\u5728\u4e0d\u540c\u7684\u73af\u5883\u4e2d\u610f\u4e49\u4e0d\u540c\u7684\u95ee\u9898\u3002<\/p>\n<p>\u5173\u4e8e QLang \u76ee\u524d\u6240\u80fd\u63d0\u4f9b\u7ed9\u5927\u5bb6\u7684\u4fe1\u606f\u57fa\u672c\u4e0a\u5c31\u8fd9\u4e48\u591a\u3002\u5982\u679c\u9700\u8981\u66f4\u591a\u5185\u5bb9\uff0c\u8bf7\u7fa4\u5185\u8ba8\u8bba\u3002<\/p>\n<p><a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/09\/multilang.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2869\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/09\/multilang.gif\" alt=\"multilang\" width=\"544\" height=\"307\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>QLang \u7684\u591a\u8bed\u8a00\u652f\u6301\u4f7f\u7528\u8d77\u6765\u4e00\u5982\u65e2\u5f80 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,9,464],"tags":[57],"class_list":["post-2865","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-qdac","category-qlang","tag-57"],"views":5098,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2865"}],"version-history":[{"count":3,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2865\/revisions"}],"predecessor-version":[{"id":2870,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2865\/revisions\/2870"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}