Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove $smwgContLang usage #1941

Merged
merged 1 commit into from
Oct 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 deletions includes/datavalues/SMW_DV_Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use SMW\DataValues\ValueFormatters\DataValueFormatter;
use SMW\Libs\Time\Timezone;
use SMW\Localizer;

/**
* @ingroup SMWDataValues
Expand Down Expand Up @@ -372,13 +373,10 @@ protected static function parseMilTimeString( $string, &$hours, &$minutes, &$sec
* @param $monthname string with standard 3-letter English month abbreviation
* @return boolean stating whether a month was found
*/
protected static function parseMonthString( $string, &$monthname ) {
/**
* @var SMWLanguage $smwgContLang
*/
global $smwgContLang;
private function parseMonthString( $string, &$monthname ) {

$monthnum = $smwgContLang->findMonth( $string ); // takes precedence over English month names!
// takes precedence over English month names!
$monthnum = Localizer::getInstance()->getExtraneousLanguage( $this->getOptionBy( self::OPT_CONTENT_LANGUAGE ) )->findMonthNumberByLabel( $string );

if ( $monthnum !== false ) {
$monthnum -= 1;
Expand Down Expand Up @@ -411,7 +409,7 @@ protected static function parseMonthString( $string, &$monthname ) {
* @return boolean stating if successful
*/
protected function interpretDateComponents( $datecomponents, &$date ) {
global $smwgContLang;

// The following code segment creates a bit vector to encode
// which role each digit of the entered date can take (day,
// year, month). The vector starts with 1 and contains three
Expand Down Expand Up @@ -461,7 +459,7 @@ protected function interpretDateComponents( $datecomponents, &$date ) {
}

// Now use the bitvector to find the preferred interpretation of the date components:
$dateformats = $smwgContLang->getDateFormats();
$dateformats = Localizer::getInstance()->getExtraneousLanguage( $this->getOptionBy( self::OPT_CONTENT_LANGUAGE ) )->getDateFormats();
$date = array( 'y' => false, 'm' => false, 'd' => false );
foreach ( $dateformats[count( $propercomponents ) - 1] as $formatvector ) {
if ( !( ~$datevector & $formatvector ) ) { // check if $formatvector => $datevector ("the input supports the format")
Expand Down
8 changes: 5 additions & 3 deletions src/DataTypeRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ public static function getInstance() {

if ( self::$instance === null ) {

$extraneousLanguage = Localizer::getInstance()->getExtraneousLanguage();

self::$instance = new self(
$GLOBALS['smwgContLang']->getDatatypeLabels(),
$GLOBALS['smwgContLang']->getDatatypeAliases(),
$GLOBALS['smwgContLang']->getCanonicalDatatypeLabels()
$extraneousLanguage->getDatatypeLabels(),
$extraneousLanguage->getDatatypeAliases(),
$extraneousLanguage->getCanonicalDatatypeLabels()
);

self::$instance->initDatatypes();
Expand Down
5 changes: 3 additions & 2 deletions src/PropertyRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ public static function getInstance() {
}

$propertyLabelFinder = ApplicationFactory::getInstance()->newPropertyLabelFinder();
$extraneousLanguage = Localizer::getInstance()->getExtraneousLanguage();

$propertyAliasFinder = new PropertyAliasFinder(
$GLOBALS['smwgContLang']->getPropertyAliases(),
$GLOBALS['smwgContLang']->getCanonicalPropertyAliases()
$extraneousLanguage->getPropertyAliases(),
$extraneousLanguage->getCanonicalPropertyAliases()
);

self::$instance = new self(
Expand Down