Преглед изворни кода

Added new [Setup] section directives MissingMessagesWarning and NotRecognizedMessagesWarning to disable warnings about messages missing or not recognized for a language.

Martijn Laan пре 4 година
родитељ
комит
4cd112b944
5 измењених фајлова са 52 додато и 9 уклоњено
  1. 2 0
      Examples/Languages.iss
  2. 26 0
      ISHelp/isetup.xml
  3. 21 9
      Projects/Compile.pas
  4. 2 0
      Projects/SetupSectionDirectives.pas
  5. 1 0
      whatsnew.htm

+ 2 - 0
Examples/Languages.iss

@@ -14,6 +14,8 @@ UninstallDisplayIcon={app}\MyProg.exe
 VersionInfoDescription=My Program Setup
 VersionInfoProductName=My Program
 OutputDir=userdocs:Inno Setup Examples Output
+MissingMessagesWarning=yes
+NotRecognizedMessagesWarning=yes
 ; Uncomment the following line to disable the "Select Setup Language"
 ; dialog and have it rely solely on auto-detection.
 ;ShowLanguageDialog=no

+ 26 - 0
ISHelp/isetup.xml

@@ -978,7 +978,9 @@ DefaultGroupName=My Program
 <li><link topic="setup_lzmanumfastbytes">LZMANumFastBytes</link></li>
 <li><link topic="setup_lzmauseseparateprocess">LZMAUseSeparateProcess</link></li>
 <li><link topic="setup_mergeduplicatefiles">MergeDuplicateFiles</link></li>
+<li><link topic="setup_missingmessageswarning">MissingMessagesWarning</link></li>
 <li><link topic="setup_missingrunonceidswarning">MissingRunOnceIdsWarning</link></li>
+<li><link topic="setup_notrecognizedmessageswarning">NotRecognizedMessagesWarning</link></li>
 <li><link topic="setup_output">Output</link></li>
 <li><link topic="setup_outputbasefilename">OutputBaseFilename</link></li>
 <li><link topic="setup_outputdir">OutputDir</link></li>
@@ -2188,6 +2190,8 @@ ButtonNext=&amp;Forward &gt;
 en.ButtonNext=&amp;Forward &gt;
 </precode>
 
+<p>If a message is missing or not recognized for a language, the compiler will warn you about this, which can be disabled using <link topic="setup_missingmessageswarning">MissingMessagesWarning</link> and  <link topic="setup_notrecognizedmessageswarning">NotRecognizedMessagesWarning</link>.</p>
+
 <heading>Special-purpose messages</heading>
 
 <p>The <a name="BeveledLabel"><tt>BeveledLabel</tt></a> message can be used to specify a line of text that is shown in the lower left corner of the wizard window and uninstaller window. The following is an example:</p>
@@ -4086,6 +4090,17 @@ Name: portablemode; Description: "Portable Mode"</pre></example>
 </body>
 </setuptopic>
 
+<setuptopic directive="MissingMessagesWarning">
+<setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
+<setupdefault><tt>yes</tt></setupdefault>
+<body>
+<p>This directive lets you disable warnings about messages missing for a language.</p>
+<p><b>See also:</b><br/>
+<link topic="setup_notrecognizedmessageswarning">NotRecognizedMessagesWarning</link>
+</p>
+</body>
+</setuptopic>
+
 <setuptopic directive="MissingRunOnceIdsWarning">
 <setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
 <setupdefault><tt>yes</tt></setupdefault>
@@ -4094,6 +4109,17 @@ Name: portablemode; Description: "Portable Mode"</pre></example>
 </body>
 </setuptopic>
 
+<setuptopic directive="NotRecognizedMessagesWarning">
+<setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
+<setupdefault><tt>yes</tt></setupdefault>
+<body>
+<p>This directive lets you disable warnings about messages not recognized for a language.</p>
+<p><b>See also:</b><br/>
+<link topic="setup_missingmessageswarning">MissingMessagesWarning</link>
+</p>
+</body>
+</setuptopic>
+
 <setuptopic directive="UsedUserAreasWarning">
 <setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
 <setupdefault><tt>yes</tt></setupdefault>

+ 21 - 9
Projects/Compile.pas

@@ -185,7 +185,7 @@ type
     FileLocationEntryFilenames: THashStringList;
     WarningsList: THashStringList;
     ExpectedCustomMessageNames: TStringList;
-    MissingRunOnceIdsWarning, MissingRunOnceIds, UsedUserAreasWarning: Boolean;
+    MissingMessagesWarning, MissingRunOnceIdsWarning, MissingRunOnceIds, NotRecognizedMessagesWarning, UsedUserAreasWarning: Boolean;
     UsedUserAreas: TStringList;
 
     PreprocIncludedFilenames: TStringList;
@@ -3919,6 +3919,9 @@ begin
         if SetupHeader.MinVersion.NTVersion < $06000000 then
           AbortCompileOnLineFmt(SCompilerMinVersionNTTooLow, ['6.0']);
       end;
+    ssMissingMessagesWarning: begin
+        MissingMessagesWarning := StrToBool(Value);
+      end;
     ssMissingRunOnceIdsWarning: begin
         MissingRunOnceIdsWarning := StrToBool(Value);
       end;
@@ -4128,6 +4131,9 @@ begin
     ssUsePreviousAppDir: begin
         SetSetupHeaderOption(shUsePreviousAppDir);
       end;
+    ssNotRecognizedMessagesWarning: begin
+        NotRecognizedMessagesWarning := StrToBool(Value);
+      end;
     ssUsedUserAreasWarning: begin
         UsedUserAreasWarning := StrToBool(Value);
       end;
@@ -6829,13 +6835,17 @@ begin
   ID := GetEnumValue(TypeInfo(TSetupMessageID), 'msg' + N);
   if ID = -1 then begin
     if LangIndex = -2 then
-      AbortCompileOnLineFmt(SCompilerMessagesNotRecognizedDefault, [N]);
-    if LineFilename = '' then
-      WarningsList.Add(Format(SCompilerMessagesNotRecognizedWarning, [N]))
-    else
-      WarningsList.Add(Format(SCompilerMessagesNotRecognizedInFileWarning,
-        [N, LineFilename]));
-    Exit;
+      AbortCompileOnLineFmt(SCompilerMessagesNotRecognizedDefault, [N])
+    else begin
+      if NotRecognizedMessagesWarning then begin
+        if LineFilename = '' then
+          WarningsList.Add(Format(SCompilerMessagesNotRecognizedWarning, [N]))
+        else
+          WarningsList.Add(Format(SCompilerMessagesNotRecognizedInFileWarning,
+            [N, LineFilename]));
+      end;
+      Exit;
+    end;
   end;
   Inc(P);
   M := P;
@@ -7181,7 +7191,7 @@ begin
     for J := Low(LangData.Messages) to High(LangData.Messages) do
       if not LangData.MessagesDefined[J] and not IsOptional(J) then begin
         { Use the message from Default.isl }
-        if not (J in [msgHelpTextNote, msgTranslatorNote]) then
+        if MissingMessagesWarning and not (J in [msgHelpTextNote, msgTranslatorNote]) then
           WarningsList.Add(Format(SCompilerMessagesMissingMessageWarning,
             [Copy(GetEnumName(TypeInfo(TSetupMessageID), Ord(J)), 4, Maxint),
              PSetupLanguageEntry(LanguageEntries[I]).Name]));
@@ -8458,6 +8468,8 @@ begin
     SetupHeader.CloseApplicationsFilter := '*.exe,*.dll,*.chm';
     SetupHeader.WizardImageAlphaFormat := afIgnored;
     MissingRunOnceIdsWarning := True;
+    MissingMessagesWarning := True;
+    NotRecognizedMessagesWarning := True;
     UsedUserAreasWarning := True;
     SetupHeader.WizardStyle := wsClassic;
 

+ 2 - 0
Projects/SetupSectionDirectives.pas

@@ -93,7 +93,9 @@ type
     ssMergeDuplicateFiles,
     ssMessagesFile,
     ssMinVersion,
+    ssMissingMessagesWarning,
     ssMissingRunOnceIdsWarning,
+    ssNotRecognizedMessagesWarning,
     ssOnlyBelowVersion,
     ssOutput,
     ssOutputBaseFilename,

+ 1 - 0
whatsnew.htm

@@ -30,6 +30,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
 
 <p><a name="6.1.3"></a><span class="ver">6.1.3-dev </span><span class="date">(?)</span></p>
 <ul>
+  <li>Added new [Setup] section directives <tt>MissingMessagesWarning</tt> and <tt>NotRecognizedMessagesWarning</tt> to disable warnings about messages missing or not recognized for a language.</li>
   <li>Links displayed by [Setup] section directives <tt>LicenseFile</tt>, <tt>InfoBeforeFile</tt> and <tt>InfoAfterFile</tt> are now executed as the original user if possible when clicked.</li>
   <li>/LOG: Now logs more uninstaller actions.</li>
   <li>Compiler IDE change: <i>Fix:</i> Autocomplete support for event functions listed some procedures as functions.</li>