With locale LANG=da_DK.UTF-8 snap will throw strange warning on snap refresh - and more snap commands

Bug #1808213 reported by zob
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu Translations
New
Undecided
De danske oversættere af Ubuntu
snapd
Confirmed
Medium
Zygmunt Krynicki
snapd (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

To reproduce change locale LANG to da_DK.UTF-8
Make sure to use ubuntu 18.10

Snap versions:

lars@lars-ThinkPad-P50-tinker:~$ snap --version
2018/12/12 19:51:16.123791 main.go:152: description of advise-snap's "from-apt" is lowercase: "advise-snap vil tale med apt via en apt-hook"
snap 2.36.2
snapd 2.36.2
series 16
ubuntu 18.10
kernel 4.18.0-12-generic

As you might have noticed above this is also thrown when running snap --version

ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: snapd 2.35.5+18.10
ProcVersionSignature: Ubuntu 4.18.0-12.13-generic 4.18.17
Uname: Linux 4.18.0-12-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.10-0ubuntu13.1
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Wed Dec 12 19:43:21 2018
InstallationDate: Installed on 2018-04-29 (227 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
ProcEnviron:
 LANG=da_DK.UTF-8
 TERM=xterm-256color
 SHELL=/bin/bash
 XDG_RUNTIME_DIR=<set>
 PATH=(custom, no user)
SourcePackage: snapd
UpgradeStatus: Upgraded to cosmic on 2018-11-03 (39 days ago)

Revision history for this message
zob (zob) wrote :
Revision history for this message
zob (zob) wrote :

Here's another person who sees this: https://askubuntu.com/questions/1088575/weird-message-when-installing-programs

Source code is in snap/main.go function lintDesc

func lintDesc(cmdName, optName, desc, origDesc string) {
 if len(optName) == 0 {
  logger.Panicf("option on %q has no name", cmdName)
 }
 if len(origDesc) != 0 {
  logger.Panicf("description of %s's %q of %q set from tag (=> no i18n)", cmdName, optName, origDesc)
 }
 if len(desc) > 0 {
  // decode the first rune instead of converting all of desc into []rune
  r, _ := utf8.DecodeRuneInString(desc)
  // note IsLower != !IsUpper for runes with no upper/lower.
  // Also note that login.u.c. is the only exception we're allowing for
  // now, but the list of exceptions could grow -- if it does, we might
  // want to change it to check for urlish things instead of just
  // login.u.c.
  if unicode.IsLower(r) && !strings.HasPrefix(desc, "login.ubuntu.com") {
   noticef("description of %s's %q is lowercase: %q", cmdName, optName, desc)
  }
 }
}

Revision history for this message
zob (zob) wrote :

Running the same snap commands with locale LANG=C there is no message.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

The localisation is wrong, the translated string should be capitalised.

Changed in snapd (Ubuntu):
status: New → Confirmed
Changed in ubuntu-translations:
assignee: nobody → De danske oversættere af Ubuntu (ubuntu-l10n-da)
Revision history for this message
scootergrisen (scootergrisen) wrote :

Maybe the translator wanted to use the command name (lower case) instead of translating "Advise" to "Rådgiv".

https://translations.launchpad.net/ubuntu/cosmic/+source/snapd/+pots/snappy/da/+translate?batch=10&show=all&search=Advise+will+talk+to+apt+via+an+apt+hook

    Advise will talk to apt via an apt hook
    advise-snap vil tale med apt via en apt-hook

Some options:
    Rådgiv vil tale med apt via en apt-hook
    Rådgivning vil tale med apt via en apt-hook
    Advise vil tale med apt via en apt-hook
    Kommandoen advise-snap vil tale med apt via en apt-hook

I will leave it up to other to select what is best.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I recently worked on something similar, let me look at this closely.

Changed in snapd:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Zygmunt Krynicki (zyga)
Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

Thanks for reporting this, and to all of you for the discussion.

I/we discussed this when translating it.

The problem is that 'advise(-snap)' is used like a verb, but is also the name of a command. This means when we translate it, we need to choose either a proper translation (i.e., a verb), or we need to keep the name of the command, which is of course case sensitive.

However we (translators) are normally content in knowing that the translation contains the same information as the original string. So we may choose either. It is actually somewhat surprising that the code performs this check. Does anybody know why? I suspect that the current translation is okay, and therefore should not be cause for warning (at least not to the user).

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

Sorry, I meant to say that it is used as a noun, not a verb. But this does not change much.

Revision history for this message
John Lenton (chipaca) wrote :

Reading the code, the English original is wrong also. Apologies for that; we'll fix.

It should read like "command", with Advise being a verb.

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

So what will happen exactly on the dev side?

There are many cases in snappy where command names are used rather interchangeably as command names (nouns) or verbs, prompting translators to decide which of the two to pick. Should I/we update the string to get rid of the warning? (Maybe for next language pack update)

General i18n advice: It is probably worth writing a "# TRANSLATORS: <insert text here>" comment if the translators should know something in particular.

Revision history for this message
zob (zob) wrote :

As you probably know, this is still an issue in the danish ubuntu-translations of ubuntu 19.04.

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

Right - the English string wasn't changed after all.

Why do you, Zygmunt Krynicki (zyga), think the translation is wrong? The string is "Advise will talk to apt via an apt hook". Advise is used as a noun here, which is of course wrong unless referring to a command. So why would it be wrong to translate this to the actual command name given that we don't have a translation for that command as such?

I think the warning is probably wrong. Why does it need to check upper/lower case? What does this framework even do about languages that don't have upper/lower case?

Snappy does not provide a string which is simply "Advise". That would be necessary in order to establish a translation of the name.

TL;DR From what I can see, this is a program or i18n error, not a localization error.

Revision history for this message
John Lenton (chipaca) wrote :

> What does this framework even do about languages that don't have upper/lower case?

the check is only that it does not start with lowercase. If a language does not have upper/lowercase, it can't start with lowercase.

Yes, the help string for "--from-apt" is wrong in English. That is a bug we (snapd devs) can fix. It should be something like "talk to apt via an apt hook", or maybe "run as an apt hook". That does not make it Ok for translators to one-sidedly ignore the 'This should not start with a lowercase letter.' message they see.

Revision history for this message
John Lenton (chipaca) wrote :

I've proposed a change to snapd

https://github.com/snapcore/snapd/pull/6865

which should address (some of) this issue.

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

I have changed the translation now ("Kommunikér med apt via en apt-hook"), but please keep in mind that I/we have definitely not been one-sidedly ignoring anything. AFAIK it was the English string which was supposed to change, and the warning persists only because this did not happen.

Please explain what problem is caused by the string being in lowercase. As a general i18n rule, the program should not process the translations. I still don't understand why there would be anything wrong with the previous translation. It is also liable to change back if someone reviews and updates the module, since Launchpad doesn't allow writing comments to other translators explaining why an unusual rewrite was chosen.

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

Just FYI, translators don't see this kind of warning while translating because we don't really the resources (or an appropriate environment) to compile and test the programs. The best I can do is usually to infer the context by looking at the source code.

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

missed a word: ... don't really /have/ the resources ....

Revision history for this message
John Lenton (chipaca) wrote :

Yeah, I know you don't see the warning. We do periodically import them and run the test, but the cycle is super slow. That's why we put all the // TRANSLATORS: messages in...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.