瀏覽代碼

fix translations widgets

Markus-Rost 4 年之前
父節點
當前提交
5491e0412b
共有 4 個文件被更改,包括 7 次插入4 次删除
  1. 1 1
      README.md
  2. 2 2
      cmds/rcscript.js
  3. 1 1
      cmds/settings.js
  4. 3 0
      util/i18n.js

+ 1 - 1
README.md

@@ -1,4 +1,4 @@
-# Wiki-Bot[<img src="https://weblate.frisk.space/widgets/wiki-bot/-/svg-badge.svg" alt="Translation status" align="right" />](#translations)
+# Wiki-Bot[<img src="https://weblate.frisk.space/widgets/wiki-bot/-/svg-badge.svg" alt="Translation status" align="right" />](#translations)[<img src="https://github.com/Markus-Rost/discord-wiki-bot/workflows/Node.js CI/badge.svg" alt="Node.js CI" align="right" />](https://github.com/Markus-Rost/discord-wiki-bot/actions)
 [<img src="https://commons.gamepedia.com/media/9/93/Cursebot.png" alt="Wiki-Bot" align="right" />](https://discord.com/oauth2/authorize?client_id=461189216198590464&permissions=939912256&scope=bot)
 
 **Wiki-Bot** is a bot for [Discord](https://discord.com/) with the purpose to easily link and search [MediaWiki](https://www.mediawiki.org/wiki/MediaWiki) sites like [Gamepedia](https://www.gamepedia.com/) and [Fandom](https://www.fandom.com/) wikis. **Wiki-Bot** shows short descriptions and additional info about pages and is able to resolve redirects and follow interwiki links.

+ 2 - 2
cmds/rcscript.js

@@ -328,7 +328,7 @@ function cmd_rcscript(lang, msg, args, line, wiki) {
 				}
 
 				msg.client.fetchWebhook(...selected_row.webhook.split('/')).then( webhook => {
-					webhook.send( new Lang(allLangs.map[args[1]]).get('rcscript.webhook.updated_lang', allLangs.names[allLangs.map[args[1]]]), {files:[`./RcGcDb/locale/widgets/${args[1]}.png`]} ).catch(log_error);
+					webhook.send( new Lang(allLangs.map[args[1]]).get('rcscript.webhook.updated_lang', allLangs.names[allLangs.map[args[1]]]), {files:[`./RcGcDb/locale/widgets/${allLangs.map[args[1]]}.png`]} ).catch(log_error);
 				}, log_error );
 				return db.run( 'UPDATE rcgcdw SET lang = ? WHERE webhook = ?', [allLangs.map[args[1]], selected_row.webhook], function (error) {
 					if ( error ) {
@@ -337,7 +337,7 @@ function cmd_rcscript(lang, msg, args, line, wiki) {
 						return error;
 					}
 					console.log( '- RcGcDw successfully updated.' );
-					msg.replyMsg( lang.get('rcscript.updated_lang') + ' `' + allLangs.names[allLangs.map[args[1]]] + '`\n`' + cmd + '`', {files:[`./RcGcDb/locale/widgets/${args[1]}.png`]}, true );
+					msg.replyMsg( lang.get('rcscript.updated_lang') + ' `' + allLangs.names[allLangs.map[args[1]]] + '`\n`' + cmd + '`', {files:[`./RcGcDb/locale/widgets/${allLangs.map[args[1]]}.png`]}, true );
 				} );
 			}
 			if ( args[0] === 'display' ) {

+ 1 - 1
cmds/settings.js

@@ -246,7 +246,7 @@ function cmd_settings(lang, msg, args, line, wiki) {
 					if ( msg.guild.id in voice ) voice[msg.guild.id] = guild.lang;
 				}
 				if ( channel || !( msg.guild.id in patreons ) || !rows.some( row => row.channel === msg.channel.id ) ) lang = new Lang(allLangs.map[args[1]]);
-				msg.replyMsg( lang.get('settings.' + prelang + 'changed') + ' `' + allLangs.names[allLangs.map[args[1]]] + '`\n' + lang.get('settings.langhelp', prefix + 'settings ' + prelang) + ' `' + Object.values(allLangs.names).join('`, `') + '`', {files:[`./i18n/widgets/${args[1]}.png`]}, true );
+				msg.replyMsg( lang.get('settings.' + prelang + 'changed') + ' `' + allLangs.names[allLangs.map[args[1]]] + '`\n' + lang.get('settings.langhelp', prefix + 'settings ' + prelang) + ' `' + Object.values(allLangs.names).join('`, `') + '`', {files:[`./i18n/widgets/${allLangs.map[args[1]]}.png`]}, true );
 				var channels = rows.filter( row => row.channel && row.lang === guild.lang && row.wiki === guild.wiki && row.prefix === guild.prefix && row.inline === guild.inline ).map( row => row.channel );
 				if ( channels.length ) db.run( 'DELETE FROM discord WHERE channel IN (' + channels.map( row => '?' ).join(', ') + ')', channels, function (delerror) {
 					if ( delerror ) {

+ 3 - 0
util/i18n.js

@@ -131,6 +131,7 @@ class Lang {
  * @returns {String}
  */
 function plural(lang, number, args) {
+	// https://translatewiki.net/wiki/Plural/Mediawiki_plural_rules
 	var text = args[args.length - 1];
 	switch ( lang ) {
 		case 'fr':
@@ -159,9 +160,11 @@ function plural(lang, number, args) {
 			break;
 		case 'de':
 		case 'en':
+		case 'es':
 		case 'nl':
 		case 'pt':
 		case 'tr':
+		case 'ja':
 		case 'zh-hans':
 		case 'zh-hant':
 		default: