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

Some things... #46

Closed
ghost opened this issue Jul 21, 2014 · 23 comments
Closed

Some things... #46

ghost opened this issue Jul 21, 2014 · 23 comments

Comments

@ghost
Copy link

ghost commented Jul 21, 2014

The mouse it sticks on some content. Could you please add an option for change the position of the windows like cinnamon, and by default the drag and drop need to be disabled.

Could you please add language support? See:
https://github.com/linuxmint/Cinnamon/pull/2283/files#L1R25
linuxmint/cinnamon#2245

Thanks...

@jake-phy
Copy link
Owner

I'll try thanks for reporting.

@jake-phy
Copy link
Owner

What do i do with this error? "A translation team for your language (fr) does not exist yet"

@ghost
Copy link
Author

ghost commented Jul 21, 2014

Mmm... This is an error, or you are thinking that no one want to translate the applet? When you create a translation support sure that some people want to translate the applet. If it's an error, first time that i see this.

@jake-phy
Copy link
Owner

I don't think it is a error. it’s just I don't know how to submit for a translation.

From: Lester Carballo Pérez
Sent: ‎Monday‎, ‎July‎ ‎21‎, ‎2014 ‎1‎:‎53‎ ‎AM
To: jake-phy/WindowIconList
Cc: jake.phy@gmail.com

Mmm... This is an error, or you are thinking that no one want to translate the applet? When you create a translation support sure that some people want to translate the applet. If it's an error, first time that i see this.


Reply to this email directly or view it on GitHub.

@ghost
Copy link
Author

ghost commented Jul 21, 2014

Using the translation mechanism allow you, that only are translate an applet if there are a translation file on your language... Otherwise the applet it's show on english... So, you don't need display this type of errors...

@ghost
Copy link
Author

ghost commented Jul 21, 2014

1- To create a pot file:

  • cd "MyAppletFolder"
  • Execute: cinnamon-json-makepot -j "myapplet"

2- Clean duplicate key:

  • msguniq "myapplet".pot > fixed.pot

The default way it's that you put your po file in the po folder(inside applet root dir).
On applet install cinnamon compile your po file in the mo file and on applet start you
need to connected your applet with the translation.

You have function to test locally the translation:

cd "MyAppletFolder"
cinnamon-json-makepot -i This compile your po file and move the .mo to the correct place.
cinnamon-json-makepot -r This uninstall your po file.

I don't want to use the cinnamon mechanims i use my own mechanims to do all that.
I precompile the mo file using poedit and put the result mo file in a folder colled mo.
I have a function called execInstallLanguage that move the mo file to the correct place.

The conection mechanims:

  • All mo file need to be set in the correct place.
  • You need to import:
    const Gettext = imports.gettext;
  • You need to have a direct function to translate string in the root code file:
function _(str) {
   let resultConf = Gettext.dgettext('WindowListGroup@jake.phy@gmail.com', str);
   if(resultConf != str) { //This is just to test that you have your own translation
      return resultConf;
   }
   return Gettext.gettext(str); //This allow a translation for cinnamon translation mechanims.
}

When applet init you need to binding to the translation folder:

  _init: function (orientation, panel_height, instance_id) {
      Gettext.bindtextdomain(this._uuid, GLib.get_home_dir() + "/.local/share/locale");

@jake-phy
Copy link
Owner

Ok thanks for adding it.

@jake-phy
Copy link
Owner

Is everything covered in the latest release?

@ghost
Copy link
Author

ghost commented Jul 26, 2014

Not really, the sticky mouse problem continues, less but happen... And man, you really need see what the other people do... My translation was only an example, not for release... you can change the es.mo to en.mo to see how translation works... Also you can create an en.po without translation or with the same translation. Or also used to not need any more change the default english key, just made the change in the en.po file.

@ghost
Copy link
Author

ghost commented Jul 26, 2014

Another thing: What happend with this:
description: Enable hover peek
tooltips: Group the open app instances into single icon

This is the correct tooltips?

@ghost
Copy link
Author

ghost commented Jul 26, 2014

@jake-phy i fully recomend you this applet, to not need open spices for see if there are a new comment... : https://github.com/collinss/Spices-Notifier

@jake-phy
Copy link
Owner

thanks for that applet. This Language stuff is still confusing me. Do the translations need to be done manually by people?

@ghost
Copy link
Author

ghost commented Jul 26, 2014

language have a key and value, you need to provide a key and people provide the value in the corresponding languages...

@jake-phy
Copy link
Owner

If you have a bunch of mo files, the execInstallLanguage function really slows down the load time. it increased the load time on my applet by 1000ms. I was looking at the weather applet and it just uses po files is there some gain by using mo files?

@ghost
Copy link
Author

ghost commented Jul 26, 2014

Yes, this is true. Cinnamon install your languages when applet was installed. This function copy the mo file to the corresponding place only, and this will be do by cinnamon if you move your .po file to ./po folder by you, but if you install the appler manually this not occurs of course. this is why i don't like the mechanims of cinnamon. see that i try to check a change in file to only copy the file when is needed, this is the comment line in this function, but i don't find a function to do that yet... If you find one?

@ghost
Copy link
Author

ghost commented Jul 26, 2014

One solution could be commented the call to the function on the release and move the .po file to the po folder... For other case, you can use the function...

@jake-phy
Copy link
Owner

There should be some way to compare dates modified to see if the file needs copied.

-----Original Message-----
From: "Lester Carballo Pérez" notifications@github.com
Sent: ‎7/‎26/‎2014 3:24 PM
To: "jake-phy/WindowIconList" WindowIconList@noreply.github.com
Cc: "jake-phy" jake.phy@gmail.com
Subject: Re: [WindowIconList] Some things... (#46)

Yes, this is true. Cinnamon install your languages when applet was installed. This function copy the mo file to the corresponding place only, and this will be do by cinnamon if you move your .po file to ./po folder by you, but if you install the appler manually this not occurs of course. this is why i don't like the mechanims of cinnamon. see that i try to check a change in file to only copy the file when is needed, this is the comment line in this function, but i don't find a function to do that yet... If you find one?

Reply to this email directly or view it on GitHub.

@ghost
Copy link
Author

ghost commented Jul 26, 2014

I try to do that, but Gio file return null when i try to acces to this function or something similar...
The last way was use the file size, but not work like i aspected... See:

getFileSize: function(path) {
if(this.fileExists(path)) {
let _attribute = "filesystem::size";
try {
let _file = Gio.file_new_for_path(path);
return _file.query_filesystem_info(_attribute, null).get_attribute_uint64(_attribute);
} catch(e) {
return 0;
}
}
return 0;
},

https://bugs.launchpad.net/sbackup/+bug/1310957

You can try to play with query_filesystem_info there are several info that you can extract from files...

@jake-phy
Copy link
Owner

    try {
        let _shareFolder = GLib.get_home_dir() + "/.local/share/";
        let _localeFolder = Gio.file_new_for_path(_shareFolder + "locale/");
        let _moFolder = Gio.file_new_for_path(_shareFolder + "cinnamon/applets/" + this._uuid + "/locale/mo/");

        let children = _moFolder.enumerate_children('standard::name,standard::type,time::modified',
                                                   Gio.FileQueryInfoFlags.NONE, null);
        let info, child, _moFile, _moLocale, _moPath;

        while ((info = children.next_file(null)) != null) {
            let type = info.get_file_type();
            let modified = info.get_modification_time().tv_sec;
            if (type == Gio.FileType.REGULAR) {
                _moFile = info.get_name();
                if (_moFile.substring(_moFile.lastIndexOf(".")) == ".mo") {
                    _moLocale = _moFile.substring(0, _moFile.lastIndexOf("."));
                    _moPath = _localeFolder.get_path() + "/" + _moLocale + "/LC_MESSAGES/";
                    let src = Gio.file_new_for_path(String(_moFolder.get_path() + "/" + _moFile));
                    let dest = Gio.file_new_for_path(String(_moPath + this._uuid + ".mo"));
                    let destModified = dest.query_info('time::modified', Gio.FileQueryInfoFlags.NONE, null).get_modification_time().tv_sec;
                    try {
                        if(modified > destModified) {
                            this._makeDirectoy(dest.get_parent());
                            src.copy(dest, Gio.FileCopyFlags.OVERWRITE, null, null);
                        }
                    } catch(e) {
                        global.logError(e);
                    }
                }
            }
        }
    } catch(e) {
        global.logError(e);
    }

That should do it.

@ghost
Copy link
Author

ghost commented Jul 26, 2014

Hey exclent!!! Thanks!!! When i try do do a similar thing, i always get a problem.... I don't know why, but not matter, you can doed!!!

@ghost
Copy link
Author

ghost commented Aug 10, 2014

I test this, and now i wait some days... Ocurrs that if you compare the tvtime in the same day it's also the same, so the file will do not replace, this is why i don't use this option... But if you wait a day the tvtime it's different... I don' t know if tvtime use minutes, hours or days to update the value. Do you know that?

@ghost
Copy link
Author

ghost commented Aug 10, 2014

Could be poedit, some time this work well: https://developer.gnome.org/glib/unstable/glib-Date-and-Time-Functions.html#GTimeVal

take care when it's the first time dest file not exist and you need to copy the file in this case without ask for tv_sec.

@jake-phy
Copy link
Owner

Ahh good point thanks.

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

No branches or pull requests

1 participant