Руссификация аплетов Cinnamon.
Добавлено: 02 сен 2016, 20:23
В Cinnamon не часто, но попадаются не русифицированные аплеты. Впринципе, ни какой трагедии нет. Покажу на примере с аплетом ScreenShot.
Cinnamon хранит файлы конфигураций аплетов в папке
Смотрим
Названия папок созвучны с названием аплетов. А собственно файлик называется applet.js
Т.е., в нашем случае нужно набрать в терминале:
В редакторе откроется вот такое содержимое:
Вовсе не нужно знать JS что-бы разобраться с проблемой. Просто пробегите глазами, или воспользуйтесь Ctrl + F для поиска, что-бы найти виновников торжества.
Поехали. (Строки вставляю "как есть", чтобы было понятней)
Первая нужная строка отвечает за всплывающее название аплета
Найти
Заменить на
Добрались до меню
Найти
Заменить на
Найти
Заменить на
Найти
Заменить на
Найти
Заменить на
Найти
Заменить на
Найти
Заменить на
Найти
Заменить на
Перезагружаем Cinnomon. Готово.
Для ленивых целиком:
Cinnamon хранит файлы конфигураций аплетов в папке
Код: Выделить всё
~/.local/share/cinnamon/applets/
Код: Выделить всё
cd ~/.local/share/cinnamon/applets/
ls
places-bookmarks@dmo60.de ScreenShot@tech71 weather@mockturtl
Т.е., в нашем случае нужно набрать в терминале:
Код: Выделить всё
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;
}
Поехали. (Строки вставляю "как есть", чтобы было понятней)
Первая нужная строка отвечает за всплывающее название аплета
Найти
Код: Выделить всё
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) {
Для ленивых целиком:
Код: Выделить всё
//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;
}