Introduce new "language code" parameter type into API base
Open, LowPublic

Description

Many modules may require user to specify a "langcode", which we should provide in the base.

Invalid characters (validated as not matching ^[a-z:_\-]+$ or something similar by the Language classes) will cause an error to be reported.

The base class will autodetect if any params have the 'langcode' type and report the that module may return this error (similar to 'badcontinue')


Version: 1.21.x
Severity: enhancement

Details

Reference
bz46100
bzimport raised the priority of this task from to Low.
bzimport set Reference to bz46100.
bzimport added a subscriber: Unknown Object (MLST).
Yurik created this task.Mar 14 2013, 5:24 AM

Commited gerrit 57047

https://gerrit.wikimedia.org/r/57047 (Gerrit Change I03008949d964dc7a122e2fce2deae19c997887d0) | change ABANDONED [by Umherirrender]

Abandon: There are different validation methods in the Language class for different use cases and work flows, so this should be done inside the modules, which than can choose the necessary validation.

In my opinion this is a WONTFIX, because it cannot provided by a base class.

Other ideas, when somebody want this in the base class:

  • Provide a way, to get a language object for the param from given language code. Avoids factory calls inside the module.
  • Allow a default value to get the user or the content language for the param. Avoids is_null checks inside the modules.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 9 2015, 1:44 PM