Страница 1 из 1

Руссификация аплетов Cinnamon.

Добавлено: 02 сен 2016, 20:23
di_mok
В Cinnamon не часто, но попадаются не русифицированные аплеты. Впринципе, ни какой трагедии нет. Покажу на примере с аплетом ScreenShot.

Cinnamon хранит файлы конфигураций аплетов в папке

Код: Выделить всё

~/.local/share/cinnamon/applets/
Смотрим

Код: Выделить всё

cd ~/.local/share/cinnamon/applets/
ls
places-bookmarks@dmo60.de  ScreenShot@tech71  weather@mockturtl
Названия папок созвучны с названием аплетов. А собственно файлик называется applet.js

Т.е., в нашем случае нужно набрать в терминале:

Код: Выделить всё

xed ~/.local/share/cinnamon/applets/ScreenShot@tech71/applet.js
В редакторе откроется вот такое содержимое:

Код: Выделить всё

//ScreenShot Applet By Infektedpc
const Applet = imports.ui.applet;
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
const Util = imports.misc.util;

function ConfirmDialog(){
    this._init();
}


function MyApplet(orientation) {
    this._init(orientation);
}

MyApplet.prototype = {
    __proto__: Applet.IconApplet.prototype,

    _init: function(orientation) {        
        Applet.IconApplet.prototype._init.call(this, orientation);
        
        try {        
            this.set_applet_icon_symbolic_name("camera-photo-symbolic");
            this.set_applet_tooltip(_("Take A Screen Shot"));
            
            this.menuManager = new PopupMenu.PopupMenuManager(this);
            this.menu = new Applet.AppletPopupMenu(this, orientation);
            this.menuManager.addMenu(this.menu);        
                                                                
            this._contentSection = new PopupMenu.PopupMenuSection();
            this.menu.addMenuItem(this._contentSection);                    
                                                    
          
		//Advanced Screenshot - opens gnome-screenshot
		this.menu.addAction(_("ScreenShot"), function(event) {
                Main.Util.spawnCommandLine("gnome-screenshot --interactive");
		}); 

		//Whole Screen - Dropdown Menu		
		this.screenshotItem = new PopupMenu.PopupSubMenuMenuItem(_("Whole Screen")); 
		//1 Sec Delay
		this.screenshotItem.menu.addAction(_("1 Second Delay"), function(actor, event) {
		Main.Util.spawnCommandLine("gnome-screenshot --delay 1");
		});
		//3 Sec Delay
		this.screenshotItem.menu.addAction(_("3 Second Delay"), function(actor, event) {
		Main.Util.spawnCommandLine("gnome-screenshot --delay 3");
		}); 
		//5 Sec Delay
		this.screenshotItem.menu.addAction(_("5 Second Delay"), function(actor, event) {
		Main.Util.spawnCommandLine("gnome-screenshot --delay 5");
		});  
                       
		this.menu.addMenuItem(this.screenshotItem); 



		//Current Window
		this.menu.addAction(_("Current Window"), function(event) {
                Main.Util.spawnCommandLine("gnome-screenshot -w");
		}); 

		//Selected Area
		this.menu.addAction(_("Selected Area"), function(event) {
                Main.Util.spawnCommandLine("gnome-screenshot -a");
		});
	
                        
        }
        catch (e) {
            global.logError(e);
        }
    },
    
    on_applet_clicked: function(event) {
        this.menu.toggle();        
    },
        
    
};

function main(metadata, orientation) {  
    let myApplet = new MyApplet(orientation);
    return myApplet;      
}
Вовсе не нужно знать JS что-бы разобраться с проблемой. Просто пробегите глазами, или воспользуйтесь Ctrl + F для поиска, что-бы найти виновников торжества.

Поехали. (Строки вставляю "как есть", чтобы было понятней)

Первая нужная строка отвечает за всплывающее название аплета
Найти

Код: Выделить всё

            this.set_applet_tooltip(_("Take A Screen Shot"));
Заменить на

Код: Выделить всё

            this.set_applet_tooltip(_("Сделать снимок экрана"));
Добрались до меню
Найти

Код: Выделить всё

            this.set_applet_tooltip(_("Take A Screen Shot"));
Заменить на

Код: Выделить всё

            this.set_applet_tooltip(_("Сделать снимок экрана"));
Найти

Код: Выделить всё

		this.screenshotItem = new PopupMenu.PopupSubMenuMenuItem(_("Whole Screen"));

Заменить на

Код: Выделить всё

		this.screenshotItem = new PopupMenu.PopupSubMenuMenuItem(_("Весь экран"));


Найти

Код: Выделить всё

		this.screenshotItem.menu.addAction(_("1 Second Delay"), function(actor, event) {
Заменить на

Код: Выделить всё

		this.screenshotItem.menu.addAction(_("Задержка 1 сек."), function(actor, event) {
Найти

Код: Выделить всё

		this.screenshotItem.menu.addAction(_("3 Second Delay"), function(actor, event) {
Заменить на

Код: Выделить всё

		this.screenshotItem.menu.addAction(_("Задержка 3 сек."), function(actor, event) {
Найти

Код: Выделить всё

		this.screenshotItem.menu.addAction(_("5 Second Delay"), function(actor, event) {
Заменить на

Код: Выделить всё

		this.screenshotItem.menu.addAction(_("Задержка 5 сек."), function(actor, event) {
Найти

Код: Выделить всё

		this.menu.addAction(_("Current Window"), function(event) {
Заменить на

Код: Выделить всё

		this.menu.addAction(_("Текущее окно"), function(event) {
Найти

Код: Выделить всё

		this.menu.addAction(_("Selected Area"), function(event) {
Заменить на

Код: Выделить всё

		this.menu.addAction(_("Выбранная область"), function(event) {
Перезагружаем Cinnomon. Готово.

Для ленивых целиком:

Код: Выделить всё

//ScreenShot Applet By Infektedpc
const Applet = imports.ui.applet;
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
const Util = imports.misc.util;

function ConfirmDialog(){
    this._init();
}


function MyApplet(orientation) {
    this._init(orientation);
}

MyApplet.prototype = {
    __proto__: Applet.IconApplet.prototype,

    _init: function(orientation) {        
        Applet.IconApplet.prototype._init.call(this, orientation);
        
        try {        
            this.set_applet_icon_symbolic_name("camera-photo-symbolic");
            this.set_applet_tooltip(_("Сделать снимок экрана"));
            
            this.menuManager = new PopupMenu.PopupMenuManager(this);
            this.menu = new Applet.AppletPopupMenu(this, orientation);
            this.menuManager.addMenu(this.menu);        
                                                                
            this._contentSection = new PopupMenu.PopupMenuSection();
            this.menu.addMenuItem(this._contentSection);                    
                                                    
          
		//Advanced Screenshot - opens gnome-screenshot
        this.menu.addAction(_("Снимок экрана"), function(event) {
                Main.Util.spawnCommandLine("gnome-screenshot --interactive");
		}); 

		//Whole Screen - Dropdown Menu		
        this.screenshotItem = new PopupMenu.PopupSubMenuMenuItem(_("Весь экран"));
		//1 Sec Delay
        this.screenshotItem.menu.addAction(_("Задержка 1 сек."), function(actor, event) {
		Main.Util.spawnCommandLine("gnome-screenshot --delay 1");
		});
		//3 Sec Delay
        this.screenshotItem.menu.addAction(_("Задержка 3 сек."), function(actor, event) {
		Main.Util.spawnCommandLine("gnome-screenshot --delay 3");
		}); 
		//5 Sec Delay
        this.screenshotItem.menu.addAction(_("Задержка 5 сек."), function(actor, event) {
		Main.Util.spawnCommandLine("gnome-screenshot --delay 5");
		});  
                       
		this.menu.addMenuItem(this.screenshotItem); 



		//Current Window
        this.menu.addAction(_("Текущее окно"), function(event) {
                Main.Util.spawnCommandLine("gnome-screenshot -w");
		}); 

		//Selected Area
        this.menu.addAction(_("Выбранная область"), function(event) {
                Main.Util.spawnCommandLine("gnome-screenshot -a");
		});
	
                        
        }
        catch (e) {
            global.logError(e);
        }
    },
    
    on_applet_clicked: function(event) {
        this.menu.toggle();        
    },
        
    
};

function main(metadata, orientation) {  
    let myApplet = new MyApplet(orientation);
    return myApplet;      
}

Re: Руссификация аплетов Cinnamon.

Добавлено: 07 сен 2016, 06:25
zuzabrik
Правильнее было бы не ковырять JS-файл, а создать файл с отдельной руссификацией.

Re: Руссификация аплетов Cinnamon.

Добавлено: 07 сен 2016, 10:27
Dja
а еще правильнее - multi-languages contents

Re: Руссификация аплетов Cinnamon.

Добавлено: 27 сен 2016, 10:35
Tuuur
Dja писал(а):а еще правильнее - multi-languages contents
Это как?

Re: Руссификация аплетов Cinnamon.

Добавлено: 27 сен 2016, 10:44
Dja
Tuuur, Это выходишь в сеть - кликаешь по видео - и выбираешь язык воспросизведения. С песнями так же. С текстом так же. С манами так же ) С комментами в конфигах так же ) Всё должно быть мульти-фицировано.