Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent translations #2642

Closed
michaelrsweet opened this issue Dec 27, 2007 · 4 comments
Closed

Inconsistent translations #2642

michaelrsweet opened this issue Dec 27, 2007 · 4 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.4-current
CUPS.org User: ronaly

I am using cups 1.3.3 and ddk 1.2.3. I also have my own message catalog (PO). Most of the strings are translated on different locales based on my message catalogs. But there are few strings that have their own translations and never get from my message catalog.
For example, "Tray 1", "Tray 2", "Statement".

First problem:
(ex. in French)
Expected Translations: From generated PPD:
Tray 1 - Tiroir 1 Tray 1 - Bac 1
Tray 2 - Tiroir 2 Tray 2 - Bac 2
Statement - Statement US Statement - Relevé

I understand now that the base translation in the ddk has higher
precedence than the user - supplied translations.

Second problem:
The string "On" has base translations from all locales except Italian.
It does not also get translation from my message catalog now that
translation from ddk is not provided.

Is this a bug in cups ddk?

Could it be possible to set user-supplied translation as higher precedence? I think for more flexibility it is better.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: ronaly

Will this request be granted?
We have lots of translation issues because we do not control it. It seems that our PO files become useless when it is overtaken by the DDKs translations. If you let the user-defined translation to take higher precedence than the DDKs then you could minimize maintaining
the DDKs message catalogs.

However, the DDKs string translator is still valuable whenever there are strings not defined in the user's message catalog.
There is more flexibility and beneficial if the user can select which message catalog he wants to use.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Reassigning as CUPS 1.4 bug.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str2642.patch":

Index: ppdc/ppdc-catalog.cxx

--- ppdc/ppdc-catalog.cxx (revision 8049)
+++ ppdc/ppdc-catalog.cxx (working copy)
@@ -14,12 +14,6 @@
//
// Contents:
//
-// ppdcCatalog::ppdcCatalog() - Create a shared message catalog.
-// ppdcCatalog::~ppdcCatalog() - Destroy a shared message catalog.
-// ppdcCatalog::add_message() - Add a new message.
-// ppdcCatalog::find_message() - Find a message in a catalog...
-// ppdcCatalog::load_messages() - Load messages from a .po file.
-// ppdcCatalog::save_messages() - Save the messages to a .po file.
//

//
@@ -113,14 +107,16 @@
//

void
-ppdcCatalog::add_message(const char *id)// I - Message ID to add
+ppdcCatalog::add_message(

  • const char *id, // I - Message ID to add
  • const char *string) // I - Translation string
    {
    ppdcMessage *m; // Current message
    char text[1024]; // Text to translate

// Range check input...

  • if (!id || !*id)
  • if (!id)
    return;

// Verify that we don't already have the message ID...
@@ -128,10 +124,22 @@
m;
m = (ppdcMessage *)messages->next())
if (!strcmp(m->id->value, id))

  • {
  •  if (string)
    
  •  {
    
  •    m->string->release();
    
  • m->string = new ppdcString(string);
  •  }
    
    return;
  • }

// Add the message...

  • snprintf(text, sizeof(text), "TRANSLATE %s", id);
  • if (!string)
  • {
  • snprintf(text, sizeof(text), "TRANSLATE %s", id);
  • string = text;
  • }

messages->add(new ppdcMessage(id, text));
}

@@ -166,7 +174,6 @@
const char *f) // I - Message catalog file
{
cups_file_t *fp; // Message file

  • ppdcMessage *temp; // Current message
    char line[4096], // Line buffer
    *ptr, // Pointer into buffer
    id[4096], // Translation ID
    @@ -268,9 +275,7 @@
    else if (ch == ';')
    {
    // Add string...

- temp = new ppdcMessage(id, str);

  • messages->add(temp);
  • add_message(id, str);
    }
    }
    }
    @@ -293,9 +298,16 @@
  • "multiple lines"
    
    */
  • int which, // In msgid?
  • haveid, // Did we get a msgid string?
  • havestr; // Did we get a msgstr string?
  • linenum = 0;
    id[0] = '\0';
    str[0] = '\0';
  • haveid = 0;
  • havestr = 0;
  • which = 0;

while (cupsFileGets(fp, line, sizeof(line)))
{
@@ -372,19 +384,18 @@
// Create or add to a message...
if (!strncmp(line, "msgid", 5))
{

  • if (id[0] && str[0])
  • {
  • temp = new ppdcMessage(id, str);
    
  • if (haveid && havestr)
  • add_message(id, str);
    
  • messages->add(temp);
    

- }

strlcpy(id, ptr, sizeof(id));
str[0] = '\0';
  • haveid = 1;
  • havestr = 0;
  • which = 1;
    }
    else if (!strncmp(line, "msgstr", 6))
    {
  • if (!id[0])
  • if (!haveid)
    {
    _cupsLangPrintf(stderr,
    _("ERROR: Need a msgid line before any "
    @@ -395,10 +406,12 @@
    }

strlcpy(str, ptr, sizeof(str));

  • havestr = 1;

  • which = 2;
    }

  •  else if (line[0] == '\"' && str[0])
    
  •  else if (line[0] == '\"' && which == 2)
    

    strlcat(str, ptr, sizeof(str));

  •  else if (line[0] == '\"' && id[0])
    
  •  else if (line[0] == '\"' && which == 1)
    

    strlcat(id, ptr, sizeof(id));
    else
    {
    @@ -409,12 +422,8 @@
    }
    }

  • if (id[0] && str[0])

  • {

- temp = new ppdcMessage(id, str);

  •  messages->add(temp);
    
  • }

  • if (haveid && havestr)

  •  add_message(id, str);
    

    }
    else
    goto unknown_load_format;

    Index: ppdc/ppdc.h

    --- ppdc/ppdc.h (revision 8049)
    +++ ppdc/ppdc.h (working copy)
    @@ -164,8 +164,7 @@
    ppdcCatalog(const char *l, const char *f = 0);
    ~ppdcCatalog();

  • void add_message(ppdcMessage *m) { messages->add(m); }

  • void add_message(const char *id);

  • void add_message(const char *id, const char *string = NULL);
    const char *find_message(const char *id);
    int load_messages(const char *f);
    int save_messages(const char *f);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant