Page MenuHomePhabricator

Allow localization of the magic words ISBN, RFC, PMID
Open, LowestPublic

Description

Different languages use different terms for ISBN. In Persian, شابک is used, and in Arabic, ردمك is used. It would be great if "ISBN" could be translated so a phrase like this would be linked on wikis with Persian content language:

شابک 964-000-000-1


Version: 1.13.x
Severity: enhancement

Details

Reference
bz13335

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:06 PM
bzimport set Reference to bz13335.
bzimport added a subscriber: Unknown Object (MLST).

I changed the summary to reflect that we have three hardcoded magic words: ISBN, RFC, PMID

Any comments on this? How about using wrapper templates for those? I don't like the idea of introducing more magic words of this kind.

I'm leaning to wontfix if nobody opposes. Plain-word magic words are competing in the same area of interwiki links and wrapper templates.

WONTFIX per comment 3 and the absence of objections.

Rich_Farmbrough subscribed.

Lets fix this. This ticket has been used as an excuse to remove the functionality form the English Wikipedia among other places, riding roughshod over the wishes of the community. That is assuming other scripts don't just insert "ISBN" - which I have seen very often.

Something like this:

isbn
      = prefix:( 'ISBN' / 'شابک' / 'ردمك' ) sp:space_or_nbsp+ isbn:(
          [0-9]
          (s:space_or_nbsp_or_dash &[0-9] { return s; } / [0-9])+
          ((space_or_nbsp_or_dash / "") [xX] / "")
        ) isbncode:(
          end_of_word
          {
            // Convert isbn token-and-entity array to stripped string.
            return tu.flattenStringlist(isbn).filter(function(e) {
              return e.constructor === String;
            }).join('').replace(/[^\dX]/ig, '').toUpperCase();
          }
        ) &{
           // ISBNs can only be 10 or 13 digits long (with a specific format)
           return isbncode.length === 10 ||
                 (isbncode.length === 13 && /^97[89]/.test(isbncode));
        } {
        const tsr = tsrOffsets();
          return [
            new SelfclosingTagTk('extlink', [
               new KV('href', 'Special:BookSources/' + isbncode),
               new KV('mw:content', tu.flattenString([prefix, sp, isbn]), tu.expandTsrV(tsr)),
               new KV('typeof', 'mw:WikiLink/ISBN'),
            ],
            { stx: "magiclink", tsr }),
          ];
    }