Changeset 92824 in vbox for trunk/src/VBox
- Timestamp:
- Dec 8, 2021 3:18:32 PM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk
r92403 r92824 96 96 VBoxManageHelp.cpp \ 97 97 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp \ 98 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_en_US.cpp \ 98 99 VBoxManageHostonly.cpp \ 99 100 VBoxManageInfo.cpp \ … … 117 118 118 119 ifdef VBOX_WITH_VBOXMANAGE_NLS 120 VBOX_PATH_VBOXMANAGE_SRC := $(PATH_SUB_CURRENT) 121 include $(PATH_SUB_CURRENT)/nls/ApprovedLanguages.kmk 122 119 123 VBoxManage_DEFS += VBOX_WITH_VBOXMANAGE_NLS 120 124 VBoxManage_INCS += \ … … 123 127 $(PATH_ROOT)/src/VBox/Main/src-all/VirtualBoxTranslator.cpp \ 124 128 $(PATH_ROOT)/src/VBox/Main/src-all/QMTranslatorImpl.cpp \ 125 $(PATH_ROOT)/src/VBox/Main/src-all/GlobalStatusConversion.cpp 129 $(PATH_ROOT)/src/VBox/Main/src-all/GlobalStatusConversion.cpp \ 130 131 # $(addsuffix /VBoxManageBuiltInHelp.cpp,$(addprefix $(VBoxManage_0_OUTDIR)/,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES))) 132 #VBoxManage_INTERMEDIATES += \ 133 # $(addsuffix /VBoxManageBuiltInHelp.h,$(addprefix $(VBoxManage_0_OUTDIR)/,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES))) 126 134 127 135 # define qt5 tools for translation 128 136 USES += qt5 129 130 VBOX_PATH_VBOXMANAGE_SRC := $(PATH_SUB_CURRENT)131 include $(PATH_SUB_CURRENT)/nls/ApprovedLanguages.kmk132 137 133 138 PROGRAMS += VBoxManageNls … … 208 213 209 214 VBoxManage_CLEAN += \ 215 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_en_US.cpp \ 216 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_en_US.cpp.ts \ 210 217 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp \ 211 218 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp.ts \ … … 214 221 $(addprefix $(VBoxManage_0_OUTDIR)/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) 215 222 216 217 218 223 # Preprocess the xml files, applying remarks. 219 224 $(foreach file,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \ 220 , $(evalcall2 def_vbox_refentry_preprocess_for_manpage,$(VBoxManage_0_OUTDIR),$(file),$(VBOX_PATH_MANUAL_SRC)/en_US/$(file),replace-xrefs)) 221 225 , $(evalcall2 def_vbox_refentry_preprocess_for_manpage,$(VBoxManage_0_OUTDIR),$(file), \ 226 $(VBOX_PATH_MANUAL_SRC)/en_US/$(file),replace-xrefs)) 227 228 229 ## 230 # Emits rules for generating cpp files from man pages. 231 # 232 # $(evalcall2 def_vbox_man_generate_cpp_help) 233 # @param 1 Folder with preprocessed man_VBoxManage_* files 234 # @param 2 language code. 235 define def_vbox_man_generate_cpp_help 236 ifneq ($(2),en_US) 237 VBOX_DOCBOOK_REFENTRY_TO_C_HELP_$(2) = $(VBOX_PATH_MANUAL_SRC)/$(2)/docbook-refentry-to-C-help.xsl 238 else 239 VBOX_DOCBOOK_REFENTRY_TO_C_HELP_$(2) = $(VBOX_DOCBOOK_REFENTRY_TO_C_HELP) 240 endif 241 $$(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_$(2).cpp.ts \ 242 +| $$(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_$(2).cpp: \ 243 $$(VBOX_DOCBOOK_REFENTRY_TO_C_HELP_$(2)) \ 244 $$(VBOX_DOCBOOK_REFENTRY_TO_C_HELP) \ 245 $$(addprefix $(1)/,$$(filter man_VBoxManage-%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \ 246 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(MAKEFILE) | $$$$(dir $$$$@) 247 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(filter %.xml,$$^),$$(patsubst %.ts,%,$$@)) 248 $$(QUIET)$$(APPEND) -tn "$$@" \ 249 '/* Autogenerated by $$<, do not edit! */' \ 250 '' \ 251 '#include "VBoxManageBuiltInHelp.h"' \ 252 '' \ 253 'RT_C_DECLS_BEGIN' \ 254 '/* make next variables visible outside the module */' \ 255 'extern PCRTMSGREFENTRY g_apHelpEntries_$(2)[];' \ 256 'extern const uint32_t g_cHelpEntries_$(2);' \ 257 'RT_C_DECLS_END' \ 258 '' \ 259 $$(foreach refentry,$$(filter %.xml,$$^) \ 260 ,$$(NLTAB)$$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$$@") \ 261 --path '$(VBOX_PATH_MANUAL_SRC)/$(2) $(VBOX_PATH_MANUAL_SRC)/en_US' $$< $$(refentry)) 262 $$(QUIET)$$(APPEND) -n "$$@" \ 263 '' \ 264 'PCRTMSGREFENTRY g_apHelpEntries_$(2)[] =' \ 265 '{' 266 $$(foreach refentry,$$(filter %.xml,$$^) \ 267 ,$$(NLTAB)$$(QUIET)$$(APPEND) -n "$$@" \ 268 ' &g_$$(subst -,_,$$(tolower $$(patsubst man_%,%,$$(notdir $$(basename $$(refentry)))))),') 269 $$(QUIET)$$(APPEND) -n "$$@" \ 270 '};' \ 271 '' \ 272 'const uint32_t g_cHelpEntries_$(2) = RT_ELEMENTS(g_apHelpEntries_$(2));' \ 273 '' 274 $$(QUIET)$$(CP) --changed -- "$$@" "$$(patsubst %.ts,%,$$@)" 275 endef 276 # The above APPEND stuff trigger some kind of problem on some boxes when not split up... 277 # update: Fixed in SVN (strcpy -> memmove in new_job(), job.c - r2591). Just need to rebuild all platforms. 222 278 223 279 # Generate the .cpp file. 280 $(evalcall2 def_vbox_man_generate_cpp_help, $(VBoxManage_0_OUTDIR),en_US) 281 282 283 # generate built-in for the english only 224 284 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp.ts \ 225 285 +| $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp: \ 226 $(VBOX_DOCBOOK_REFENTRY_TO_C_HELP) \ 227 $(addprefix $(VBoxManage_0_OUTDIR)/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \ 228 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$(dir $$@) 229 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(filter %.xml,$^),$(patsubst %.ts,%,$@)) 286 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_en_US.cpp \ 287 $(foreach lang,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES), $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_$(lang).cpp ) \ 288 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.h 230 289 $(QUIET)$(APPEND) -tn "$@" \ 231 '/* Autogenerated by $<, do not edit! */' \290 '/* Autogenerated, do not edit! */' \ 232 291 '' \ 233 292 '#include "VBoxManageBuiltInHelp.h"' \ 234 '' 235 $(foreach refentry,$(filter %.xml,$^) \ 236 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") $< $(refentry)) 293 '' \ 294 'RT_C_DECLS_BEGIN' \ 295 '' \ 296 'extern PCRTMSGREFENTRY g_apHelpEntries_en_US[];' \ 297 'extern const uint32_t g_cHelpEntries_en_US;' 298 ifdef VBOX_WITH_VBOXMANAGE_NLS 299 $(foreach lang,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES) \ 300 ,$(NLTAB)$(QUIET)$(APPEND) -n "$@" \ 301 '' \ 302 'extern PCRTMSGREFENTRY g_apHelpEntries_$(lang)[];' \ 303 'extern const uint32_t g_cHelpEntries_$(lang);') 304 endif 237 305 $(QUIET)$(APPEND) -n "$@" \ 238 '' \ 239 'PCRTMSGREFENTRY g_apHelpEntries[] =' \ 240 '{' 241 $(foreach refentry,$(filter %.xml,$^) \ 242 ,$(NLTAB)$(QUIET)$(APPEND) -n "$@" \ 243 ' &g_$(subst -,_,$(tolower $(patsubst man_%,%,$(notdir $(basename $(refentry)))))),') 306 '' \ 307 'RT_C_DECLS_END' \ 308 '' \ 309 'HELP_LANG_ENTRY g_apHelpLangEntries[] = ' \ 310 '{' \ 311 ' {"en_US", 5, &g_apHelpEntries_en_US[0], g_cHelpEntries_en_US},' 312 ifdef VBOX_WITH_VBOXMANAGE_NLS 313 $(foreach lang,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES) \ 314 ,$(NLTAB)$(QUIET)$(APPEND) "$@" ' {"$(lang)", $(length $(lang)), &g_apHelpEntries_$(lang)[0], g_cHelpEntries_$(lang)},' ) 315 endif 244 316 $(QUIET)$(APPEND) -n "$@" \ 245 317 '};' \ 246 'const uint32_t g_cHelpEntries = RT_ELEMENTS(g_apHelpEntries);' \ 247 '' 318 '' \ 319 'const uint32_t g_cHelpLangEntries = RT_ELEMENTS(g_apHelpLangEntries);' \ 320 '' \ 321 'void * volatile g_pHelpLangEntry = (void *)&g_apHelpLangEntries[0];'\ 322 '' 248 323 $(QUIET)$(CP) --changed -- "$@" "$(patsubst %.ts,%,$@)" 249 # The above APPEND stuff trigger some kind of problem on some boxes when not split up...250 # update: Fixed in SVN (strcpy -> memmove in new_job(), job.c - r2591). Just need to rebuild all platforms.251 324 252 325 … … 259 332 $(QUIET)$(APPEND) -tn "$@" \ 260 333 '/* Autogenerated by $<, do not edit! */' \ 261 262 263 264 265 266 267 268 269 270 271 334 '' \ 335 '#ifndef ___VBoxManageBuiltInHelp_h___' \ 336 '#define ___VBoxManageBuiltInHelp_h___' \ 337 '' \ 338 '#include <iprt/message.h>' \ 339 '' \ 340 'RT_C_DECLS_BEGIN' \ 341 '' \ 342 'typedef enum HELP_CMD_VBOXMANAGE' \ 343 '{' \ 344 ' HELP_CMD_VBOXMANAGE_INVALID = 0,' 272 345 $(foreach refentry,$(filter %.xml,$^) \ 273 346 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") \ … … 281 354 $(QUIET)$(APPEND) -n "$@" \ 282 355 '' \ 283 'extern PCRTMSGREFENTRY g_apHelpEntries[];' \ 284 'extern const uint32_t g_cHelpEntries;' \ 285 '' \ 286 'RT_C_DECLS_END' \ 356 'typedef struct HELP_LANG_ENTRY' \ 357 '{' \ 358 ' const char *pszLang;' \ 359 ' size_t cbLang;' \ 360 ' PCRTMSGREFENTRY *papHelpEntries;' \ 361 ' const uint32_t cHelpEntries;' \ 362 '} HELP_LANG_ENTRY;' \ 363 '' \ 364 'extern HELP_LANG_ENTRY g_apHelpLangEntries[];' \ 365 'extern const uint32_t g_cHelpLangEntries;' \ 366 '' \ 367 'extern void * volatile g_pHelpLangEntry;' \ 368 '' \ 369 'RT_C_DECLS_END' \ 287 370 '' \ 288 371 '#endif' \ 289 372 '' 290 373 $(QUIET)$(CP) --changed -- "$@" "$(patsubst %.ts,%,$@)" 291 374 375 ifdef VBOX_WITH_VBOXMANAGE_NLS 376 VBoxManage_BLDDIRS += \ 377 $(addprefix $(VBoxManage_0_OUTDIR)/,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES)) 378 379 VBoxManage_SOURCES += \ 380 $(foreach lang, $(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES) \ 381 , $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_$(lang).cpp) 382 383 VBoxManage_CLEAN += \ 384 $(addsuffix .cpp,$(addprefix $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES))) \ 385 $(addsuffix .cpp.ts,$(addprefix $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp_,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES))) \ 386 $(foreach file, $(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \ 387 , $(addsuffix /$(file),$(addprefix $(VBoxManage_0_OUTDIR)/,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES)))) 388 389 # Preprocess the xml files, applying remarks. 390 $(foreach lang, $(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES) \ 391 , $(foreach file,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \ 392 , $(evalcall2 def_vbox_refentry_preprocess_for_manpage,$(VBoxManage_0_OUTDIR)/$(lang),$(file) \ 393 ,$(VBOX_PATH_MANUAL_SRC)/$(lang)/$(file),replace-xrefs,$(lang)))) 394 395 # Generate the .cpp file. 396 $(foreach lang, $(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES) \ 397 , $(evalcall2 def_vbox_man_generate_cpp_help,$(VBoxManage_0_OUTDIR)/$(lang),$(lang))) 398 399 # Ensure $(lang) subfolder in the $(VBOX_PATH_MANUAL_OUTBASE) is created (for section names file) 400 BLDDIRS += $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/,$(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES)) 401 402 # Generate sections names file for $(lang) 403 $(foreach lang, $(VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES) \ 404 , $(evalcall2 def_vbox_xref_to_text,$(lang))) 405 406 endif 292 407 293 408 include $(FILE_KBUILD_SUB_FOOTER) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r92538 r92824 91 91 DECLARE_TRANSLATION_CONTEXT(VBoxManage); 92 92 93 static void setBuiltInHelpLanguage(const char *pszLang); 94 93 95 #ifdef VBOX_WITH_VBOXMANAGE_NLS 94 96 /* listener class for language updates */ … … 145 147 LogFunc(("New language ID: %s\n", strLanguageId.c_str())); 146 148 pTranslator->i_loadLanguage(strLanguageId.c_str()); 149 setBuiltInHelpLanguage(strLanguageId.c_str()); 147 150 } 148 151 catch (std::bad_alloc &) … … 260 263 }; 261 264 265 266 static void setBuiltInHelpLanguage(const char *pszLang) 267 { 268 #ifdef VBOX_WITH_VBOXMANAGE_NLS 269 if (pszLang == NULL || pszLang[0] == 0 || pszLang[0] == 'C' && pszLang[1] == 0) 270 pszLang = "en_US"; 271 void *pHelpLangEntry = NULL; 272 /* find language entry matching exactly pszLang */ 273 for (uint32_t i = 0; i < g_cHelpLangEntries; i++) 274 { 275 if (strcmp(g_apHelpLangEntries[i].pszLang, pszLang) == 0) 276 { 277 pHelpLangEntry = (void *)&g_apHelpLangEntries[i]; 278 break; 279 } 280 } 281 /* find first entry containing language specified if pszLang contains only language */ 282 if (pHelpLangEntry == NULL) 283 { 284 size_t cbLang = strlen(pszLang); 285 for (uint32_t i = 0; i < g_cHelpLangEntries; i++) 286 { 287 if ( cbLang < g_apHelpLangEntries[i].cbLang 288 && memcmp(g_apHelpLangEntries[i].pszLang, pszLang, cbLang) == 0) 289 { 290 pHelpLangEntry = (void *)&g_apHelpLangEntries[i]; 291 break; 292 } 293 } 294 } 295 /* set to en_US (i.e. untranslated) if not found */ 296 if (pHelpLangEntry == NULL) 297 pHelpLangEntry = (void *)&g_apHelpLangEntries[0]; 298 299 ASMAtomicWritePtrVoid(&g_pHelpLangEntry, pHelpLangEntry); 300 #endif 301 } 302 303 262 304 /** 263 305 * Looks up a command by name. … … 549 591 { 550 592 vrc = pTranslator->i_loadLanguage(NULL); 551 if (RT_FAILURE(vrc)) 593 if (RT_SUCCESS(vrc)) 594 { 595 com::Utf8Str strLang = pTranslator->language(); 596 setBuiltInHelpLanguage(strLang.c_str()); 597 } 598 else 552 599 LogRelFunc(("Load language failed: %Rrc\n", vrc)); 553 600 } … … 765 812 { 766 813 HRESULT hrc1 = pTranslator->loadLanguage(virtualBox); 767 if (FAILED(hrc1)) 814 if (SUCCEEDED(hrc1)) 815 { 816 com::Utf8Str strLang = pTranslator->language(); 817 setBuiltInHelpLanguage(strLang.c_str()); 818 } 819 else 768 820 { 769 821 /* Just log and ignore the language error */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r92538 r92824 22 22 #include <VBox/version.h> 23 23 24 #include <iprt/asm.h> 24 25 #include <iprt/buildconfig.h> 25 26 #include <iprt/ctype.h> … … 80 81 81 82 83 /** 84 * Takes first char and make it uppercase. 85 * 86 * @returns pointer to string starting from next char. 87 * @param pszSrc Source string. 88 * @param pszFirstCharBuffer Pointer to buffer to place first char uppercase 89 */ 90 static const char *firstCharUppercase(const char *pszSrc, char *pszFirstCharBuffer) 91 { 92 RTUNICP Cp; 93 RTStrGetCpEx(&pszSrc, &Cp); 94 char *pszBuffer = RTStrPutCp(pszFirstCharBuffer, Cp); 95 RTStrToUpper(pszBuffer); 96 pszBuffer[0] = 0; 97 return pszSrc; 98 } 82 99 83 100 … … 96 113 uint32_t cPendingBlankLines = 0; 97 114 uint32_t cFound = 0; 98 for (uint32_t i = 0; i < g_cHelpEntries; i++) 99 { 100 PCRTMSGREFENTRY pHelp = g_apHelpEntries[i]; 101 if (pHelp->idInternal == (int64_t)enmCommand) 115 #ifdef VBOX_WITH_VBOXMANAGE_NLS 116 HELP_LANG_ENTRY *pHelpLangEntry[2] = {ASMAtomicReadPtrT(&g_pHelpLangEntry, HELP_LANG_ENTRY *), &g_apHelpLangEntries[0] }; 117 #else 118 HELP_LANG_ENTRY *pHelpLangEntry[1] = {(HELP_LANG_ENTRY *)g_pHelpLangEntry}; 119 #endif 120 /* Try to find translated, then untranslated */ 121 for (int k = 0; k < RT_ELEMENTS(pHelpLangEntry) && cFound == 0; k++) 122 { 123 /* skip if english is used */ 124 if (k > 0 && pHelpLangEntry[k] == pHelpLangEntry[0]) 125 break; 126 for (uint32_t i = 0; i < pHelpLangEntry[k]->cHelpEntries; i++) 102 127 { 103 cFound++;104 if ( cFound == 1)128 PCRTMSGREFENTRY pHelp = pHelpLangEntry[k]->papHelpEntries[i]; 129 if (pHelp->idInternal == (int64_t)enmCommand) 105 130 { 106 if (fSubcommandScope == RTMSGREFENTRYSTR_SCOPE_GLOBAL) 107 RTStrmPrintf(pStrm, Help::tr("Usage - %c%s:\n"), RT_C_TO_UPPER(pHelp->pszBrief[0]), pHelp->pszBrief + 1); 108 else 109 RTStrmPrintf(pStrm, Help::tr("Usage:\n")); 131 cFound++; 132 if (cFound == 1) 133 { 134 if (fSubcommandScope == RTMSGREFENTRYSTR_SCOPE_GLOBAL) 135 { 136 char szFirstChar[16] = {0}; 137 const char *pszNext = firstCharUppercase(pHelp->pszBrief, szFirstChar); 138 RTStrmPrintf(pStrm, Help::tr("Usage - %s%s:\n"), szFirstChar, pszNext); 139 } 140 else 141 RTStrmPrintf(pStrm, Help::tr("Usage:\n")); 142 } 143 RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Synopsis, fSubcommandScope, &cPendingBlankLines, &cLinesWritten); 144 if (!cPendingBlankLines) 145 cPendingBlankLines = 1; 110 146 } 111 RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Synopsis, fSubcommandScope, &cPendingBlankLines, &cLinesWritten);112 if (!cPendingBlankLines)113 cPendingBlankLines = 1;114 147 } 115 148 } … … 142 175 uint32_t cPendingBlankLines = 0; 143 176 uint32_t cFound = 0; 144 for (uint32_t i = 0; i < g_cHelpEntries; i++) 145 { 146 PCRTMSGREFENTRY pHelp = g_apHelpEntries[i]; 147 if ( pHelp->idInternal == (int64_t)enmCommand 148 || enmCommand == HELP_CMD_VBOXMANAGE_INVALID) 177 #ifdef VBOX_WITH_VBOXMANAGE_NLS 178 HELP_LANG_ENTRY *pHelpLangEntry[2] = {ASMAtomicReadPtrT(&g_pHelpLangEntry, HELP_LANG_ENTRY *), &g_apHelpLangEntries[0] }; 179 #else 180 HELP_LANG_ENTRY *pHelpLangEntry[1] = {(HELP_LANG_ENTRY *)g_pHelpLangEntry}; 181 #endif 182 /* Try to find translated, then untranslated */ 183 for (int k = 0; k < RT_ELEMENTS(pHelpLangEntry) && cFound == 0; k++) 184 { 185 /* skip if english is used */ 186 if (k > 0 && pHelpLangEntry[k] == pHelpLangEntry[0]) 187 break; 188 for (uint32_t i = 0; i < pHelpLangEntry[k]->cHelpEntries; i++) 149 189 { 150 cFound++; 151 RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Help, fSubcommandScope, &cPendingBlankLines, NULL /*pcLinesWritten*/); 152 if (cPendingBlankLines < 2) 153 cPendingBlankLines = 2; 190 PCRTMSGREFENTRY pHelp = pHelpLangEntry[k]->papHelpEntries[i]; 191 192 if ( pHelp->idInternal == (int64_t)enmCommand 193 || enmCommand == HELP_CMD_VBOXMANAGE_INVALID) 194 { 195 cFound++; 196 RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Help, fSubcommandScope, &cPendingBlankLines, NULL /*pcLinesWritten*/); 197 if (cPendingBlankLines < 2) 198 cPendingBlankLines = 2; 199 } 154 200 } 155 201 } … … 989 1035 { 990 1036 uint32_t cPendingBlankLines = 0; 991 for (uint32_t i = 0; i < g_cHelpEntries; i++) 1037 #ifdef VBOX_WITH_VBOXMANAGE_NLS 1038 HELP_LANG_ENTRY *pHelpLangEntry = ASMAtomicReadPtrT(&g_pHelpLangEntry, HELP_LANG_ENTRY *); 1039 #else 1040 HELP_LANG_ENTRY *pHelpLangEntry = (HELP_LANG_ENTRY *)g_pHelpLangEntry; 1041 #endif 1042 for (uint32_t i = 0; i < pHelpLangEntry->cHelpEntries; i++) 992 1043 { 993 PCRTMSGREFENTRY pHelp = g_apHelpEntries[i]; 1044 PCRTMSGREFENTRY pHelp = pHelpLangEntry->papHelpEntries[i]; 1045 994 1046 while (cPendingBlankLines-- > 0) 995 1047 RTStrmPutCh(pStrm, '\n'); 996 RTStrmPrintf(pStrm, " %c%s:\n", RT_C_TO_UPPER(pHelp->pszBrief[0]), pHelp->pszBrief + 1); 1048 char szFirstChar[16] = {0}; 1049 const char *pszNext = firstCharUppercase(pHelp->pszBrief, szFirstChar); 1050 RTStrmPrintf(pStrm, " %s%s:\n", szFirstChar, pszNext); 997 1051 cPendingBlankLines = 0; 998 1052 RTMsgRefEntryPrintStringTable(pStrm, &pHelp->Synopsis, RTMSGREFENTRYSTR_SCOPE_GLOBAL, 999 1053 &cPendingBlankLines, NULL /*pcLinesWritten*/); 1000 1054 cPendingBlankLines = RT_MAX(cPendingBlankLines, 1); 1001 1055 } -
trunk/src/VBox/Frontends/VBoxManage/nls/ApprovedLanguages.kmk
r92594 r92824 19 19 VBOX_APPROVED_VBOXMANAGE_LANGUAGES := \ 20 20 ru 21 22 # The list of approved VBoxManage language codes for built-in docbook 23 # help. Order matters for codes in the case of a language used in 24 # multiple countries. The language code used when no country is 25 # specified should be placed before other codes with the same language. 26 # For example: if en_US, en_UK and en_AU are approved the en_US should 27 # be placed before others allowing en_US to be used when the user 28 # specifies "en" as the desired language. 29 VBOX_APPROVED_VBOXMANAGE_DOCBOOK_LANGUAGES := -
trunk/src/VBox/Frontends/VBoxManage/nls/VBoxManageNls_ru.ts
r92603 r92824 5550 5550 <message> 5551 5551 <location filename="../VBoxManageHelp.cpp" line="107"/> 5552 <source>Usage - % c%s:5553 </source> 5554 <translation>Использование - % c%s:5552 <source>Usage - %s%s: 5553 </source> 5554 <translation>Использование - %s%s: 5555 5555 </translation> 5556 5556 </message> -
trunk/src/VBox/Main/include/VirtualBoxTranslator.h
r92068 r92824 108 108 static int32_t initCritSect(); 109 109 110 com::Utf8Str language(); 111 110 112 private: 111 113 static RTCRITSECTRW s_instanceRwLock; -
trunk/src/VBox/Main/src-all/VirtualBoxTranslator.cpp
r92145 r92824 226 226 227 227 228 com::Utf8Str VirtualBoxTranslator::language() 229 { 230 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 231 232 return m_strLanguage; 233 } 234 235 228 236 int VirtualBoxTranslator::i_loadLanguage(const char *pszLang) 229 237 {
Note:
See TracChangeset
for help on using the changeset viewer.