Skip to content

Commit

Permalink
commandOfTheDay@logg: Add Russian translation (#978)
Browse files Browse the repository at this point in the history
* Fix path replacement
  • Loading branch information
blogdron committed Dec 6, 2023
1 parent af4b3a1 commit 76198b8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 25 deletions.
50 changes: 25 additions & 25 deletions commandOfTheDay@logg/files/commandOfTheDay@logg/desklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@ function MyDesklet(metadata, desklet_id){

MyDesklet.prototype = {
__proto__: Desklet.Desklet.prototype,

_init: function(metadata, desklet_id)
{
Desklet.Desklet.prototype._init.call(this, metadata, desklet_id);

this.metadata = metadata;
this.update_id = null;

try
{
this.settings = new Settings.DeskletSettings(
this, this.metadata["uuid"], this.instance_id);

this.settings.bindProperty(Settings.BindingDirection.IN, "theCommand", "theCommand", this.on_setting_changed, null);
this.settings.bindProperty(Settings.BindingDirection.IN, "delay", "delay", this.on_setting_changed, null);
}
}
catch (e)
{
global.logError(e);
}
}

this.sep = "%"; // SPACE
this.maxSize = 7000; // Cinnamon can crash if this int is too high

this.setHeader(_("Command of the day"));
this.setup_display();
},

on_setting_changed: function()
{
if (this.update_id > 0)
Expand All @@ -58,30 +58,30 @@ MyDesklet.prototype = {
this.update_id = null;
this.setup_display();
},

on_desklet_removed: function()
{
Mainloop.source_remove(this.update_id);
},

setup_display: function()
{
this._commandContainer =
this._commandContainer =
new St.BoxLayout({vertical:true, style_class: 'command-container'});
this._command = new St.Label();

this._commandContainer.add(this._command);
this.setContent(this._commandContainer);

this.updateInProgress = false;
this.theCommand = this.theCommand.replace('~', GLib.get_home_dir()).replace(/\"/g,'\\\"'); //don't quote me on this
this.theCommand = this.theCommand.replace('file://', " ").replace(/\"/g,'\\\"'); //don't quote me on this
this.mainDir = GLib.get_home_dir()+'/.local/share/cinnamon/desklets/commandOfTheDay@logg/';
this.file = this.mainDir + "output.txt";


this._update_loop();
},

/**
* Updates every user set secconds
**/
Expand All @@ -90,7 +90,7 @@ MyDesklet.prototype = {
this._update();
this.update_id = Mainloop.timeout_add_seconds(this.delay*60, Lang.bind(this, this._update_loop));
},

/**
* Method to update the text/reading of the file
**/
Expand All @@ -105,14 +105,14 @@ MyDesklet.prototype = {
//This is the magic that runs the command
//Unfortunately, it seems piping doesn't work with imports.misc.util, and also the documentation didn't tell me how to grab output from the command, so "writeCommandOutput.sh" is the work around.
Util.spawnCommandLine("bash " + this.mainDir + "writeCommandOutput.sh \""+this.theCommand+"\"");

let commandFileContents = Cinnamon.get_file_contents_utf8_sync(this.file).toString();

// Parse chosen command for display
let commandOutput = commandFileContents.substring(0, Math.min(commandFileContents.length, this.maxSize)); // truncate if needed

this._command.set_text(commandOutput);

}
catch (e)
{
Expand All @@ -121,11 +121,11 @@ MyDesklet.prototype = {
finally
{
this.updateInProgress = false;
}
}
},

on_desklet_clicked: function(event)
{
{
this._update();
}
}
Expand Down
38 changes: 38 additions & 0 deletions commandOfTheDay@logg/files/commandOfTheDay@logg/po/ru.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-26 16:13+0800\n"
"PO-Revision-Date: 2023-12-05 10:16+0300\n"
"Last-Translator: blogdron\n"
"Language-Team: \n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.4.1\n"

#: desklet.js:48
msgid "Command of the day"
msgstr "Команда Дня"

#. commandOfTheDay@logg->metadata.json->description
msgid "A desklet that displays arbitrary text output from commands"
msgstr "Десклет отображающий произвольный текст от произвольных программ или скриптов"

#. commandOfTheDay@logg->metadata.json->name
msgid "Command of the day desklet"
msgstr "Команда Дня (Command of the day desklet)"

#. commandOfTheDay@logg->settings-schema.json->delay->description
msgid "Update every:"
msgstr "Период обновления:"

#. commandOfTheDay@logg->settings-schema.json->delay->units
msgid "minutes"
msgstr "минуты"

#. commandOfTheDay@logg->settings-schema.json->theCommand->description
msgid "Command:"
msgstr "Команда:"

0 comments on commit 76198b8

Please sign in to comment.