Skip to content

Commit

Permalink
MOBILE-3039 lang: Fix ratings lang index
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed May 29, 2019
1 parent af53d44 commit 76f470e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
18 changes: 9 additions & 9 deletions scripts/langindex.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
"addon.mod_forum.addanewquestion": "forum",
"addon.mod_forum.addanewtopic": "forum",
"addon.mod_forum.addtofavourites": "forum",
"addon.mod_forum.advanced": "forum",
"addon.mod_forum.advanced": "moodle",
"addon.mod_forum.cannotadddiscussion": "forum",
"addon.mod_forum.cannotadddiscussionall": "forum",
"addon.mod_forum.cannotcreatediscussion": "forum",
Expand Down Expand Up @@ -1645,14 +1645,14 @@
"core.question.questionno": "question",
"core.question.requiresgrading": "question",
"core.quotausage": "moodle",
"core.rating.aggregateavg": "moodle",
"core.rating.aggregatecount": "moodle",
"core.rating.aggregatemax": "moodle",
"core.rating.aggregatemin": "moodle",
"core.rating.aggregatesum": "moodle",
"core.rating.noratings": "moodle",
"core.rating.rating": "moodle",
"core.rating.ratings": "moodle",
"core.rating.aggregateavg": "rating",
"core.rating.aggregatecount": "rating",
"core.rating.aggregatemax": "rating",
"core.rating.aggregatemin": "rating",
"core.rating.aggregatesum": "rating",
"core.rating.noratings": "rating",
"core.rating.rating": "rating",
"core.rating.ratings": "rating",
"core.redirectingtosite": "local_moodlemobileapp",
"core.refresh": "moodle",
"core.remove": "moodle",
Expand Down
10 changes: 9 additions & 1 deletion scripts/moodle_to_json.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
// Set languages to do. If script is called using a language it will be used as unique.
if (isset($argv[1]) && !empty($argv[1])) {
$forcedetect = false;
define('TOTRANSLATE', true);
$languages = explode(',', $argv[1]);
} else {
$forcedetect = true;
define('TOTRANSLATE', false);
$languages = $config_langs;
}

Expand Down Expand Up @@ -160,6 +162,9 @@ function build_lang($lang, $keys, $total) {
$file = LANGPACKSFOLDER.'/'.$langfoldername.'/'.$value->file.'.php';
// Apply translations.
if (!file_exists($file)) {
if (TOTRANSLATE) {
echo "\n\t\To translate $value->string on $value->file";
}
continue;
}

Expand All @@ -169,14 +174,17 @@ function build_lang($lang, $keys, $total) {
if (!isset($string[$value->string])) {
// Not yet translated. Do not override.
if (!$langFile) {
// Load lang fils just once.
// Load lang files just once.
$langFile = file_get_contents(ASSETSPATH.$lang.'.json');
$langFile = (array) json_decode($langFile);
}
if (is_array($langFile) && isset($langFile[$key])) {
$translations[$key] = $langFile[$key];
$local++;
}
if (TOTRANSLATE) {
echo "\n\t\tTo translate $value->string on $value->file";
}
continue;
} else {
$text = $string[$value->string];
Expand Down
2 changes: 1 addition & 1 deletion src/addon/mod/forum/pages/discussion/discussion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export class AddonModForumDiscussionPage implements OnDestroy {
this.accessInfo = {};
}).then(() => {
this.defaultSubject = this.translate.instant('addon.mod_forum.re') + ' ' +
(this.discussion ? this.discussion.subject : "");
(this.discussion ? this.discussion.subject : '');
this.replyData.subject = this.defaultSubject;

const startingPost = this.forumProvider.extractStartingPost(posts);
Expand Down

0 comments on commit 76f470e

Please sign in to comment.