@@ -25,9 +25,9 @@ const { timeout_add_seconds,
2525const { to_string } = require ( "./lib/to-string" ) ;
2626
2727
28- const DESKLET_UUID = "AlbumArt3.0@claudiux" ;
28+ const UUID = "AlbumArt3.0@claudiux" ;
2929const HOME_DIR = GLib . get_home_dir ( ) ;
30- const DESKLET_DIR = HOME_DIR + "/.local/share/cinnamon/desklets/" + DESKLET_UUID ;
30+ const DESKLET_DIR = HOME_DIR + "/.local/share/cinnamon/desklets/" + UUID ;
3131const ENABLED_DESKLETS_KEY = 'enabled-desklets' ;
3232const XDG_RUNTIME_DIR = GLib . getenv ( "XDG_RUNTIME_DIR" ) ;
3333const TMP_ALBUMART_DIR = XDG_RUNTIME_DIR + "/AlbumArt" ;
@@ -40,24 +40,25 @@ const DEL_SONG_ARTS_SCRIPT = DESKLET_DIR + "/scripts/del_song_arts.sh";
4040const GET_IMAGE_SIZE_SCRIPT = DESKLET_DIR + "/scripts/get-image-size.sh" ;
4141const INSTALL_TRANSLATIONS_SCRIPT = DESKLET_DIR + "/scripts/install-translations.sh" ;
4242
43-
44- Gettext . bindtextdomain ( DESKLET_UUID , HOME_DIR + "/.local/share/locale" ) ;
45- //~ Gettext.bindtextdomain("cinnamon", "/usr/share/locale");
46-
43+ /**
44+ * _:
45+ * @str : string to try to translate.
46+ * Try firstly with UUID domain, secondly with "cinnamon" domain, then with general domain.
47+ */
48+ Gettext . bindtextdomain ( UUID , HOME_DIR + "/.local/share/locale" ) ;
49+ Gettext . bindtextdomain ( "cinnamon" , "/usr/share/locale" ) ;
4750function _ ( str ) {
48- let customTrans = Gettext . dgettext ( DESKLET_UUID , str ) ;
49- if ( customTrans != str && customTrans . length > 0 )
51+ let customTrans = Gettext . dgettext ( UUID , str ) ;
52+ if ( customTrans . length > 0 && customTrans !== str )
5053 return customTrans ;
51-
52- return str ;
53- //~ customTrans = Gettext.dgettext("cinnamon", str);
54- //~ if (customTrans !== str && customTrans.length > 0)
55- //~ return customTrans;
56-
57- //~ return Gettext.gettext(str);
54+ customTrans = Gettext . dgettext ( "cinnamon" , str ) ;
55+ if ( customTrans . length > 0 && customTrans !== str )
56+ return customTrans ;
57+ return Gettext . gettext ( str ) ;
5858}
5959
6060
61+
6162class AlbumArtRadio30 extends Desklet . Desklet {
6263 constructor ( metadata , desklet_id ) {
6364 super ( metadata , desklet_id ) ;
@@ -89,7 +90,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
8990
9091 this . _updateDecoration ( ) ;
9192
92- this . settings = new Settings . DeskletSettings ( this , DESKLET_UUID , this . instance_id ) ;
93+ this . settings = new Settings . DeskletSettings ( this , UUID , this . instance_id ) ;
9394 this . settings . bind ( 'height' , 'height' , this . on_setting_changed ) ;
9495 this . settings . bind ( 'width' , 'width' , this . on_setting_changed ) ;
9596 this . settings . bind ( 'fade-delay' , 'fade_delay' , this . on_setting_changed ) ;
@@ -116,7 +117,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
116117 var modify_ENABLED_DESKLETS_KEY = false ;
117118 for ( let i = 0 ; i < enabledDesklets . length ; i ++ ) {
118119 let [ name , dId , x , y ] = enabledDesklets [ i ] . split ( ":" ) ;
119- if ( name == DESKLET_UUID ) {
120+ if ( name == UUID ) {
120121 if ( Math . ceil ( x ) != Math . ceil ( this . desklet_x ) ) {
121122 modify_ENABLED_DESKLETS_KEY = true ;
122123 x = "" + this . desklet_x ;
@@ -205,7 +206,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
205206 var enabledDesklets = global . settings . get_strv ( ENABLED_DESKLETS_KEY ) ;
206207 for ( let i = 0 ; i < enabledDesklets . length ; i ++ ) {
207208 let [ name , dId , x , y ] = enabledDesklets [ i ] . split ( ":" ) ;
208- if ( name == DESKLET_UUID ) {
209+ if ( name == UUID ) {
209210 this . desklet_x = Math . ceil ( x ) ;
210211 this . desklet_y = Math . ceil ( y ) ;
211212 break
@@ -279,7 +280,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
279280 var enabledDesklets = global . settings . get_strv ( ENABLED_DESKLETS_KEY ) ;
280281 for ( let i = 0 ; i < enabledDesklets . length ; i ++ ) {
281282 let [ name , dId , x , y ] = enabledDesklets [ i ] . split ( ":" ) ;
282- if ( name == DESKLET_UUID ) {
283+ if ( name == UUID ) {
283284 if ( Math . ceil ( x ) != Math . ceil ( this . desklet_x ) || Math . ceil ( y ) != Math . ceil ( this . desklet_y ) ) {
284285 this . desklet_x = Math . ceil ( x ) ;
285286 this . desklet_y = Math . ceil ( y ) ;
0 commit comments