Bug 79842 - i18n: subword translation in "Can't use the same %smodule"
Summary: i18n: subword translation in "Can't use the same %smodule"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Dominique d'Humieres
URL:
Keywords:
Depends on:
Blocks: trivial_translation_nits
  Show dependency treegraph
 
Reported: 2017-03-03 22:02 UTC by Roland Illig
Modified: 2019-04-13 12:06 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-05-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Illig 2017-03-03 22:02:39 UTC
gfc_fatal_error ("Can't USE the same %smodule we're building!",
                 p->state == COMP_SUBMODULE ? "sub" : "");

The message is either of these:
* "Can't USE the same module we're building!"
* "Can't USE the same submodule we're building!"

As a translator, I have no chance of providing a proper translation for this, since the word part "sub" is always introduced.

Translations should always be complete sentences. In this case, the easiest solution is this:

  for (p = gfc_state_stack; p; p = p->previous)
    if ((p->state == COMP_MODULE || p->state == COMP_SUBMODULE)
	 && strcmp (p->sym->name, module_name) == 0)
      if (p->state == COMP_SUBMODULE)
        gfc_fatal_error ("Can't USE a submodule that is currently built");
      else
        gfc_fatal_error ("Can't USE a module that is currently built");

This also fixes #79840 by removing the exclamation mark and rewording the diagnostic.
Comment 1 Dominique d'Humieres 2017-05-19 14:28:59 UTC
Do you agree with the change in comment 0? If yes, I can do the testing and packaging.
Comment 2 Paul Thomas 2017-05-19 15:35:16 UTC
(In reply to Dominique d'Humieres from comment #1)
> Do you agree with the change in comment 0? If yes, I can do the testing and
> packaging.

Yes, that's fine by me.

Thanks

Paul
Comment 3 Roland Illig 2019-04-04 23:45:14 UTC
Any progress on this one? To me it sounds like it were quite easy to fix.
Comment 4 Dominique d'Humieres 2019-04-06 10:44:36 UTC
Updated patch I am planning to commit

--- ../_clean/gcc/fortran/module.c	2019-03-21 20:46:46.000000000 +0100
+++ gcc/fortran/module.c	2019-04-06 12:40:17.000000000 +0200
@@ -7144,8 +7144,10 @@ gfc_use_module (gfc_use_list *module)
   for (p = gfc_state_stack; p; p = p->previous)
     if ((p->state == COMP_MODULE || p->state == COMP_SUBMODULE)
 	 && strcmp (p->sym->name, module_name) == 0)
-      gfc_fatal_error ("Cannot USE the same %smodule we're building",
-		       p->state == COMP_SUBMODULE ? "sub" : "");
+      if (p->state == COMP_SUBMODULE)
+        gfc_fatal_error ("Cannot USE a submodule that is currently built");
+      else
+        gfc_fatal_error ("Cannot USE a module that is currently built");
 
   init_pi_tree ();
   init_true_name_tree ();

AFAICT the errors are not covered by the test suite.
Comment 5 Dominique d'Humieres 2019-04-06 14:49:38 UTC
The patch in comment 4 does not bootstrap:

../../work/gcc/fortran/module.c: In function 'void gfc_use_module(gfc_use_list*)':
../../work/gcc/fortran/module.c:7145:8: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=dangling-else]
 7145 |     if ((p->state == COMP_MODULE || p->state == COMP_SUBMODULE)
      |        ^
cc1plus: all warnings being treated as errors

This one does

--- ../_clean/gcc/fortran/module.c	2019-03-21 20:46:46.000000000 +0100
+++ gcc/fortran/module.c	2019-04-06 16:39:02.000000000 +0200
@@ -7144,8 +7144,12 @@ gfc_use_module (gfc_use_list *module)
   for (p = gfc_state_stack; p; p = p->previous)
     if ((p->state == COMP_MODULE || p->state == COMP_SUBMODULE)
 	 && strcmp (p->sym->name, module_name) == 0)
-      gfc_fatal_error ("Cannot USE the same %smodule we're building",
-		       p->state == COMP_SUBMODULE ? "sub" : "");
+      {
+	if (p->state == COMP_SUBMODULE)
+	  gfc_fatal_error ("Cannot USE a submodule that is currently built");
+	else
+	  gfc_fatal_error ("Cannot USE a module that is currently built");
+      }
 
   init_pi_tree ();
   init_true_name_tree ();
Comment 6 dominiq 2019-04-13 11:33:21 UTC
Author: dominiq
Date: Sat Apr 13 11:32:49 2019
New Revision: 270338

URL: https://gcc.gnu.org/viewcvs?rev=270338&root=gcc&view=rev
Log:
2019-04-13  Dominique d'Humieres  <dominiq@gcc.gnu.org>

	PR fortran/79842
	* module.c (gfc_use_module): use complete sentences.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
Comment 7 Dominique d'Humieres 2019-04-13 12:06:36 UTC
Closing. It would be nice if someone commits tests covering the errors.