Ubuntu

Gmail webapp integration only works fine if english launguage is set

Reported by Claudio Arseni on 2012-11-09
82
This bug affects 16 people
Affects Status Importance Assigned to Milestone
WebApps: Applications Data
Undecided
Maxim Ermilov
unity-webapps-gmail (Ubuntu)
Undecided
Unassigned
webapps-applications (Ubuntu)
Raring
Undecided
Unassigned

Bug Description

I'm able to have the counter enabled on the Launcher icon and Gmail labels in the indicator only when I set "English" language in gmail interface, otherwise I can only have Gmail icon in Launcher and Indicator that only allow to open gmail.

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: unity-webapps-gmail 2.4.7
ProcVersionSignature: Ubuntu 3.5.0-18.29-generic 3.5.7
Uname: Linux 3.5.0-18-generic i686
ApportVersion: 2.6.1-0ubuntu6
Architecture: i386
Date: Fri Nov 9 09:25:13 2012
InstallationDate: Installed on 2012-10-04 (35 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Beta i386 (20120929)
MarkForUpload: True
PackageArchitecture: all
ProcEnviron:
 TERM=screen
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=it_IT.UTF-8
 SHELL=/bin/bash
SourcePackage: unity-webapps-gmail
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Claudio Arseni (claudio.arseni) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity-webapps-gmail (Ubuntu):
status: New → Confirmed
Francesco (8snake2) wrote :

Same here.
Ubuntu 64bit
I've update from 12.04.

Maxim Ermilov (zaspire) on 2012-11-12
Changed in webapps-applications:
assignee: nobody → Maxim Ermilov (zaspire)
Maxim Ermilov (zaspire) on 2012-11-15
Changed in webapps-applications:
status: New → Fix Committed
milestone: none → 2.4.5
Maxim Kuznetsov (mackuzzz) wrote :

It even does not appear in Messaging menu for me. I've added it manually through dconf-editor, icon appeared but I can't launch Gmail in Chromium with it. And no counter in Launcher.
And here is the problem with Russian version of Google Calendar: https://bugs.launchpad.net/ubuntu/+source/libunity-webapps/+bug/1079546

Maxim Ermilov (zaspire) on 2012-11-19
Changed in webapps-applications:
status: Fix Committed → Fix Released
milestone: 2.4.5 → 2.4.11
John Larsen (dmessiahpchan) wrote :

Oh so THAT's why it never worked for me.

It is the same problem for Danish. I have to change to the English version for the gmail webapp to work properly.

Antoine Apollis (belloswan) wrote :

Same for me. I use Gmail in French, and the icon doesn’t show the number of unread messages and the messaging menu doesn't appear.
When I switch to English (US), it works fine.
N.B.: I have a Google Apps account in fact but this doesn't change anything, because the webapp works when the language is English.

Antoine Apollis (belloswan) wrote :

I found a solution for this bug; the patch is attached.
I only replaced on the line 59 the [@aria-label="Navigate to"] which depends on the language used by [@id=":rb"] which is unique.

I also changed the "GMail" label by the "Gmail" label correctly wroten on line 123, which corrects the bug #1062890.

It works perfectly now, even in French. Please tell me what you think about my patch.

The attachment "GMail.user.js" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Manuel (yo-elmanu) wrote :

It works in spanish after belloswan's patch.
Thanks!

Francesco (8snake2) wrote :

It work perfectly with your patch, in italian too! Thanks.

Download full text (4.7 KiB)

Solucion para Gmail-Unity-webapps (Solved)

Configurar el Gmail en idioma ESPAÑOL LATINOAMERICANO

Editar el archivo /usr/share/unity-webapps/userscripts/unity-webapps-gmail/GMail.user.js con sudo gedit /usr/share/unity-webapps/userscripts/unity-webapps-gmail/GMail.user.js

Cambiar donde dice "Navigate to" por "Ir a"

var tag = document.evaluate('//div[@aria-label="Navigate to"]/span', document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;

 var tag = document.evaluate('//div[@aria-label="Ir a"]/span', document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;

Grabar

// ==UserScript==
// @include https://mail.google.com/*
// @require utils.js
// @require google-common.js
// ==/UserScript==

window.Unity = external.getUnityObject(1);
var pane = null;

function isCorrectPage() {
    var i, ids = ['hist_frame', 'js_frame'];

    for (i = 0; i < ids.length; i++) {
        if (!document.getElementById(ids[i])) {
            return false;
        }
    }

    return true;
}

function getNumber(str) {
    try {
        var onlyNumber = str.match(/\(([0-9]|,)+\)/)[0].match(/([0-9]|,)+/)[0];

        return onlyNumber.replace(/,/g, "");
    } catch (x) {
        return '0';
    }
}

function getLabels() {
    var i, res = [];

    var snapshot = document.evaluate('//div[2]/div/div/div[5]/div/*/div/div/div[2]/span/a',
                                     pane, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

    for (i = 0; i < snapshot.snapshotLength; i++) {
        var node = snapshot.snapshotItem(i);

        res.push({ name: node.textContent.match(/^[^(]+/)[0],
                   count: getNumber(node.textContent),
                   link: node.href });
    }

    return res;
}

function doMatrixIntegration() {
    doMainMenuIntegration(document);

    var i, labels = getLabels();
    for (i = 0; i < labels.length; i++) {
        Unity.addAction('/' + labels[i].name, makeRedirector(labels[i].link));
    }
}

function checkMessangesCount() {
    var tag = document.evaluate('//div[@aria-label="Ir a"]/span', document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;

    if (tag.textContent != 'Gmail' && tag.textContent != 'Mail') {
        return;
    }

    var inboxLink = document.evaluate('//div[@role="navigation"]/div/div/div/div/div/div/div/div/div/span/a', document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
    var numMessanges = getNumber(inboxLink.text);

    var indicators = [];
    indicators.push({ name: _("Inbox"),
        count: numMessanges,
        callback: makeRedirector(inboxLink.href) });
    var i, labels = getLabels();
    for (i = 0; i < labels.length; i++) {
 indicators.push({ name: labels[i].name, count: labels[i].count, callback: makeRedirector(labels[i].link) });
    }
    showIndicators(indicators);
    Unity.Launcher.setCount(Number(numMessanges));
}

function unityLoaded() {
    var composeNewMessage = wrapCallback(function () {
        var compose = document.evaluate('//div[@role="navigation"]/div[1]/div[1]/div[1][@role="button"]', document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;

        click(compose);
   ...

Read more...

pulpo (pulpox) wrote :

belloswan's patch worked for me (Spanish configuration)

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in webapps-applications (Ubuntu Raring):
status: New → Confirmed
Bence Lukács (lukacs-bence1) wrote :

This bug still affects me on 13.04, unity-webapps-gmail version 2.4.7.
However belloswan's script works for me too! It should be accepted.

papukaija (papukaija) wrote :

Looking at the attachments in this bug report, I noticed that one was flagged as a patch incorrectly. A patch contains changes to an Ubuntu package that will resolve a bug, since this was not one I've unchecked the patch flag for it. In the future keep in mind the definition of a patch. You can learn more about what qualifies as a patch at https://wiki.ubuntu.com/Bugs/Patches. Thanks!

tags: removed: patch
papukaija (papukaija) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 1069576, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

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

Other bug subscribers