Skip to content

Commit

Permalink
Merge branch 'MDL-75970' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyatregubov committed Oct 13, 2022
2 parents 3fa533a + abeedec commit 3f6a102
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions admin/tool/customlang/cli/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Options:
-l, --lang Comma seperated language ids to export, default: all
-c, --components Comma seperated components to export, default: all
-t, --target Target to copy the zip files to, default: $CFG->tempdir/customlang
-t, --target Target directory to copy the zip files to, default: $CFG->tempdir/customlang
-o, --overwrite Overwrite existing files in the target folder.
Note: If the target is not set, the files are always overwritten!
-h, --help Print out this help
Expand Down Expand Up @@ -73,9 +73,10 @@
echo $usage;
die;
}
if (!file_exists($options['target'])) {
mkdir($options['target'], 0777, true);
}

// Ensure target directory exists.
$options['target'] = rtrim($options['target'], '/') . '/';
check_dir_exists($options['target']);

cli_writeln(get_string('cliexportheading', 'tool_customlang'));
$langs = [];
Expand All @@ -90,7 +91,7 @@
$filename = $options['target'] . get_string('exportzipfilename', 'tool_customlang', ['lang' => $lang]);
// If the file exists and we are not using the temp folder it requires an ovewrite.
if ($options['target'] != $dafaulttarget && file_exists($filename) && !$options['overwrite']) {
cli_problem(get_string('cliexportfileexists', 'tool_customlang', $lang));
cli_problem(get_string('cliexportfileexists', 'tool_customlang', ['lang' => $lang]));
continue;
}
cli_heading(get_string('cliexportstartexport', 'tool_customlang', $lang));
Expand Down
1 change: 1 addition & 0 deletions admin/tool/customlang/lang/en/tool_customlang.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
$string['customlang:view'] = 'View local translation';
$string['export'] = 'Export custom strings';
$string['exportfilter'] = 'Select component(s) to export';
$string['exportzipfilename'] = 'customlang-export-{$a->lang}.zip';
$string['editlangpack'] = 'Edit language pack';
$string['filter'] = 'Filter strings';
$string['filtercomponent'] = 'Show strings of these components';
Expand Down

0 comments on commit 3f6a102

Please sign in to comment.