You are here

public static function CalendarSystemsArgHandlerTrait::translate in Calendar Systems 8.3

5 calls to CalendarSystemsArgHandlerTrait::translate()
CalendarSystemsArgHandlerTrait::query in src/Plugin/views/argument/CalendarSystemsArgHandlerTrait.php
CalendarSystemsViewsDate::opBetween in src/Plugin/views/filter/CalendarSystemsViewsDate.php
Filters by operator between.
CalendarSystemsViewsDate::opSimple in src/Plugin/views/filter/CalendarSystemsViewsDate.php
@inheritDoc
CalendarSystemsViewsDateTime::opBetween in src/Plugin/views/filter/CalendarSystemsViewsDateTime.php
Override parent method, which deals with dates as integers.
CalendarSystemsViewsDateTime::opSimple in src/Plugin/views/filter/CalendarSystemsViewsDateTime.php
@inheritDoc

File

src/Plugin/views/argument/CalendarSystemsArgHandlerTrait.php, line 20

Class

CalendarSystemsArgHandlerTrait

Namespace

Drupal\calendar_systems\Plugin\views\argument

Code

public static function translate($v) {
  $pass_0 = [
    'ﻯ' => 'ی',
    'ﻱ' => 'ی',
    '٠' => '0',
    '۱' => '1',
    '۲' => '2',
    '۳' => '3',
    '۴' => '4',
    '۵' => '5',
    '۶' => '6',
    '۷' => '7',
    '۸' => '8',
    '۹' => '9',
    '١' => '1',
    '٢' => '2',
    '٣' => '3',
    '٤' => '4',
    '٥' => '5',
    '٦' => '6',
    '٧' => '7',
    '٨' => '8',
    '٩' => '9',
  ];
  $pass_1 = [
    'امروز' => 'today',
    'دیروز' => '-1 day',
    'فردا' => '+1 day',
    'پیش' => 'ago',
    'قبل' => 'last',
    'بعد' => 'later',
    'بعدی' => 'next',
    'ثانیه' => 'second',
    'دقیقه' => 'minute',
    'ساعت' => 'hour',
    'روز' => 'day',
    'ماه' => 'month',
    'سال' => 'year',
    'هفته' => 'week',
  ];
  $v = trim($v);
  $v = strtr($v, $pass_0);
  $v = strtr($v, $pass_1);
  return $v;
}