Przeglądaj źródła

Add Swedish and small fixes

Markus-Rost 4 lat temu
rodzic
commit
80ebbb1313
6 zmienionych plików z 172 dodań i 7 usunięć
  1. 1 0
      dashboard/i18n.js
  2. 9 0
      dashboard/i18n/sv.json
  3. 5 7
      functions/verify.js
  4. 1 0
      i18n/en.json
  5. 155 0
      i18n/sv.json
  6. 1 0
      util/i18n.js

+ 1 - 0
dashboard/i18n.js

@@ -143,6 +143,7 @@ function plural(lang, number, args) {
 		case 'nl':
 		case 'pt-br':
 		case 'th':
+		case 'sv':
 		case 'tr':
 		case 'vi':
 		case 'zh-hans':

+ 9 - 0
dashboard/i18n/sv.json

@@ -0,0 +1,9 @@
+{
+    "fallback": [
+        "en",
+        " ",
+        " ",
+        " ",
+        " "
+    ]
+}

+ 5 - 7
functions/verify.js

@@ -37,7 +37,7 @@ function verify(lang, channel, member, username, wiki, rows, old_username = '')
 			}
 			else if ( body?.error?.code === 'us400' ) { // special catch for Fandom
 				if ( !old_username ) logging(wiki, channel.guild.id, 'verification');
-				embed.setTitle( escapeFormatting( old_username || username ) ).setColor('#0000FF').setDescription( lang.get('verify.user_missing', escapeFormatting( old_username || username )) );
+				embed.setTitle( escapeFormatting( old_username || username ) ).setColor('#0000FF').setDescription( lang.get('verify.user_missing', escapeFormatting( old_username || username )) ).addField( lang.get('verify.notice'), lang.get('verify.help_missing') );
 				result.content = lang.get('verify.user_missing_reply', escapeFormatting( old_username || username ));
 			}
 			else {
@@ -53,20 +53,18 @@ function verify(lang, channel, member, username, wiki, rows, old_username = '')
 		embed.setAuthor( body.query.general.sitename );
 		if ( body.query.users.length !== 1 || queryuser.missing !== undefined || queryuser.invalid !== undefined ) {
 			username = ( body.query.users.length === 1 ? queryuser.name : username );
-			embed.setTitle( escapeFormatting( old_username || username ) ).setColor('#0000FF').setDescription( lang.get('verify.user_missing', escapeFormatting( old_username || username )) );
+			embed.setTitle( escapeFormatting( old_username || username ) ).setColor('#0000FF').setDescription( lang.get('verify.user_missing', escapeFormatting( old_username || username )) ).addField( lang.get('verify.notice'), lang.get('verify.help_missing') );
+			result.content = lang.get('verify.user_missing_reply', escapeFormatting( old_username || username ));
 			if ( wiki.isFandom() && !old_username ) return got.get( wiki + 'api/v1/User/UsersByName?limit=1&query=' + encodeURIComponent( username ) + '&format=json' ).then( wsresponse => {
 				var wsbody = wsresponse.body;
 				if ( wsresponse.statusCode !== 200 || wsbody?.exception || wsbody?.users?.[0]?.name?.length !== username.length ) {
 					if ( !wsbody?.users ) console.log( '- ' + wsresponse.statusCode + ': Error while searching the user: ' + wsbody?.exception?.details );
-					result.content = lang.get('verify.user_missing_reply', escapeFormatting(username));
 					return;
 				}
 				return wsbody.users[0].name;
 			}, error => {
 				console.log( '- Error while searching the user: ' + error );
-				result.content = lang.get('verify.user_missing_reply', escapeFormatting(username));
 			} );
-			result.content = lang.get('verify.user_missing_reply', escapeFormatting( old_username || username ));
 			return;
 		}
 		username = queryuser.name;
@@ -140,8 +138,8 @@ function verify(lang, channel, member, username, wiki, rows, old_username = '')
 				if ( authortag !== discordname ) {
 					embed.setColor('#FFFF00').setDescription( lang.get('verify.user_failed', member.toString(), '[' + escapeFormatting(username) + '](' + pagelink + ')', queryuser.gender) );
 					var help_link = '';
-					if ( wiki.isGamepedia() ) help_link = lang.get('verify.help_gamepedia') + '?c=' + ( patreons[channel.guild.id] && patreons[channel.guild.id] !== process.env.prefix ? encodeURIComponent( patreons[channel.guild.id] + ' verify' ) : 'wb' ) + ( channel.name !== 'verification' ? '&ch=' + encodeURIComponent( channel.name ) : '' ) + '&user=' + toTitle(username) + '&discord=' + encodeURIComponent( member.user.username ) + '&tag=' + member.user.discriminator;
-					else if ( wiki.isFandom() ) help_link = lang.get('verify.help_fandom') + '/' + toTitle(username) + '?c=' + ( patreons[channel.guild.id] && patreons[channel.guild.id] !== process.env.prefix ? encodeURIComponent( patreons[channel.guild.id] + ' verify' ) : 'wb' ) + ( channel.name !== 'verification' ? '&ch=' + encodeURIComponent( channel.name ) : '' ) + '&user=' + encodeURIComponent( member.user.username ) + '&tag=' + member.user.discriminator + '&useskin=oasis';
+					if ( wiki.isGamepedia() ) help_link = lang.get('verify.help_gamepedia') + '?c=' + ( patreons[channel.guild.id] && patreons[channel.guild.id] !== process.env.prefix ? encodeURIComponent( patreons[channel.guild.id] + 'verify' ) : 'wb' ) + ( channel.name !== 'verification' ? '&ch=' + encodeURIComponent( channel.name ) : '' ) + '&user=' + toTitle(username) + '&discord=' + encodeURIComponent( member.user.username ) + '&tag=' + member.user.discriminator;
+					else if ( wiki.isFandom() ) help_link = lang.get('verify.help_fandom') + '/' + toTitle(username) + '?c=' + ( patreons[channel.guild.id] && patreons[channel.guild.id] !== process.env.prefix ? encodeURIComponent( patreons[channel.guild.id] + 'verify' ) : 'wb' ) + ( channel.name !== 'verification' ? '&ch=' + encodeURIComponent( channel.name ) : '' ) + '&user=' + encodeURIComponent( member.user.username ) + '&tag=' + member.user.discriminator + '&useskin=oasis';
 					if ( help_link.length ) embed.addField( lang.get('verify.notice'), lang.get('verify.help_guide', help_link, queryuser.gender) + '\n' + help_link );
 					result.content = lang.get('verify.user_failed_reply', escapeFormatting(username), queryuser.gender);
 					return;

+ 1 - 0
i18n/en.json

@@ -796,6 +796,7 @@
         "help_fandom": "https://community.fandom.com/wiki/Special:VerifyUser",
         "help_gamepedia": "https://help.fandom.com/wiki/Gamepedia_Help_Wiki:Discord_verification",
         "help_guide": "Follow [this guide]($1) to add your Discord tag to your wiki profile:",
+        "help_missing": "Please make sure you are using your wiki username and the caseing is correct.",
         "help_subpage": "Please add your Discord tag ($1) to your Discord subpage on the wiki:",
         "missing": "there are no verifications set up for this channel.",
         "notice": "Notice:",

+ 155 - 0
i18n/sv.json

@@ -0,0 +1,155 @@
+{
+    "__translator": [
+        "",
+        " ",
+        " ",
+        " ",
+        " ",
+        " ",
+        " ",
+        " ",
+        " ",
+        " "
+    ],
+    "aliases": {
+        "bug": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "command": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "diff": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "discussion": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "help": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "info": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "invite": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "overview": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "page": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "random": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "search": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "test": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "user": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ],
+        "verify": [
+            "",
+            " ",
+            " ",
+            " ",
+            " "
+        ]
+    },
+    "fallback": [
+        "en",
+        " ",
+        " ",
+        " ",
+        " "
+    ],
+    "test": {
+        "text": [
+            "",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " ",
+            " "
+        ]
+    }
+}

+ 1 - 0
util/i18n.js

@@ -204,6 +204,7 @@ function plural(lang, number, args) {
 		case 'nl':
 		case 'pt-br':
 		case 'th':
+		case 'sv':
 		case 'tr':
 		case 'vi':
 		case 'zh-hans':