Localisation updates from https://translatewiki.net.
[mediawiki.git] / resources / src / mediawiki.special.block / util.js
blob351a49042fce62b8392ab8417038ef04a732f260
1 const util = {
2         /**
3          * Get the message for the given block flag
4          *
5          * @param {string} flag
6          * @return {string}
7          */
8         getBlockFlagMessage: function ( flag ) {
9                 // Potential messages:
10                 // * block-log-flags-anononly
11                 // * block-log-flags-nocreate
12                 // * block-log-flags-noautoblock
13                 // * block-log-flags-noemail
14                 // * block-log-flags-nousertalk
15                 // * block-log-flags-angry-autoblock
16                 // * block-log-flags-hiddenname
17                 return mw.message( 'block-log-flags-' + flag ).text();
18         },
19         /**
20          * Format a timestamp
21          *
22          * @param {string} timestamp
23          * @return {string}
24          */
25         formatTimestamp: function ( timestamp ) {
26                 if ( mw.util.isInfinity( timestamp ) ) {
27                         return mw.msg( 'infiniteblock' );
28                 }
29                 return new Date( timestamp ).toLocaleString( undefined, { timeZone: 'UTC', timeZoneName: 'short' } );
30         },
31         /**
32          * Get the message for a given block action
33          *
34          * @param {string} action
35          * @return {string}
36          */
37         getBlockActionMessage: function ( action ) {
38                 // Potential messages:
39                 // * log-action-filter-block-block
40                 // * log-action-filter-block-reblock
41                 // * log-action-filter-block-unblock
42                 return mw.message( 'log-action-filter-block-' + action ).text();
43         }
46 module.exports = util;