Finds all nodetranslations where title is like the given $title parameter


@param string $title
@param string $lang  (optional, if not specified all languages will be
returned)

@return array
164240
public function getNodeTranslationsLikeTitle($title, $lang = null)
    {
        /** @var QueryBuilder $qb */
        $qb = $this->getNodeTranslationsQueryBuilder($lang);
        $qb->andWhere('nt.title like :title')
            ->setParameter('title', '%' . $title . '%');

        return $qb->getQuery()->getResult();
    }
99430
public function getAllParents(Node $node = null, $lang = null)
    {
        if (is_null($node)) {
            return array();
        }

        $qb = $this->createQueryBuilder('node');

        // Directly hydrate the nodeTranslation and nodeVersion
        $qb->select('node', 't', 'v')
            ->innerJoin('node.nodeTranslations', 't')
            ->leftJoin(
                't.publicNodeVersion',
                'v',
                'WITH',
                't.publicNodeVersion = v.id'
            )
            ->where('node.deleted = 0');

        if ($lang) {
            $qb->andWhere('t.lang = :lang')
                ->setParameter('lang', $lang);
        }

        $qb->andWhere(
            $qb->expr()->andX(
                $qb->expr()->lte('node.lft', $node->getLeft()),
                $qb->expr()->gte('node.rgt', $node->getRight())
            )
        );

        $qb->addOrderBy('node.lft', 'ASC');

        return $qb->getQuery()->getResult();
    }
942967
private function prepareBlockTranslation(Language $language, $title = null, $isActive = null)
    {
        $faker = Factory::create($language->i18n);
        return [
            'language_code' => $language->code,
            'title'         => ($title) ? $title : $faker->realText(38, 1),
            'body'          => $faker->realText(300),
            'custom_fields' => array_combine($this->faker->words(), $this->faker->words()),
            'is_active'     => (bool) ($title) ? $isActive : rand(0, 1)
        ];
    }
1279906
public List<Series> searchSeries(String title, String language) throws TvDbException {
        StringBuilder urlBuilder = new StringBuilder();

        try {
            urlBuilder.append(BASE_URL)
                      .append("GetSeries.php?seriesname=")
                      .append(URLEncoder.encode(title, "UTF-8"));
            if (StringUtils.isNotBlank(language)) {
                urlBuilder.append("&language=").append(language);
            }
        } catch (UnsupportedEncodingException ex) {
            LOG.trace("Failed to encode title: {}", title, ex);
            // Try and use the raw title
            urlBuilder.append(title);
        }

        LOG.trace(URL, urlBuilder.toString());
        return TvdbParser.getSeriesList(urlBuilder.toString());
    }
933432
def core__get_menu_title_translation title, module_name
      return title if (!title.start_with?('translate'))

      title_key = core__get_string_inside_strings(title, '[', ']')
      module_languages = core__get_module_languages(module_name)
      return title if !module_languages || !module_languages[:menu] || !module_languages[:menu][title_key]

      return module_languages[:menu][title_key]
    end
1300857
private function findPostByTitle($title)
    {
        $postEntity = $this->getPhabric()->getEntity('Post');
        $post = $postEntity->getNamedItem($title);

        if (!$post) {
            throw new \LogicException(sprintf('Could not find a blog post of given title: "%s"', $title));
        }

        return $post;
    }
1197943
public function getTitle($language = null)
    {
        if (!isset($this->titles[$language])) {
            return current($this->titles);
        }

        return $this->titles[$language];
    }
746486
protected function _parseLang($src = null, $lang) {
        if ($src == null) {
            $file = APP_RESOURCE_LANG_PATH . $lang . '.xml';
            $src = 'app';
        }
        else {
            $file = SRC_PATH . $src . '/' . SRC_RESOURCE_LANG_PATH . $lang . '.xml';
        }

        $this->config['lang']['' . $src . '']['' . $lang . ''] = [];

        if (file_exists($file)) {
            if ($xml = simplexml_load_file($file)) {
                $values = $xml->xpath('//lang');

                /** @var SimpleXMLElement[] $value */
                foreach ($values as $value) {
                    $data = null;

                    foreach ($this->_langAttribute as $attribute) {
                        $attributeType = $attribute['name'];

                        if (is_object($value[$attributeType])) {
                            $data[$attributeType] = $value[$attributeType]->__toString();
                        }
                        else {
                            $data[$attributeType] = '';
                        }

                        /** @var SimpleXMLElement $value */
                        $data['content'] = $value->__toString();
                    }

                    $data = $this->_parseParent($value, $data, $this->_langAttribute);

                    $this->config['lang']['' . $src . '']['' . $lang . '']['' . $data['name'] . ''] = $data;
                    $this->config['lang']['' . $src . '']['' . $lang . '']['' . $data['name'] . ''] = $this->config['lang']['' . $src . '']['' . $lang . '']['' . $data['name'] . '']['content'];
                }
            }
            else {
                throw new MissingConfigException('can\'t read file "' . $file . '"');
            }
        }
        else {
            throw new MissingConfigException('can\'t open file "' . $file . '"');
        }
    }
785326
def match_lang(self, el, langs):
        """"""

        match = False
        has_ns = self.supports_namespaces()
        root = self.root
        has_html_namespace = self.has_html_namespace

        # Walk parents looking for `lang` (HTML) or `xml:lang` XML property.
        parent = el
        found_lang = None
        last = None
        while not found_lang:
            has_html_ns = self.has_html_ns(parent)
            for k, v in self.iter_attributes(parent):
                attr_ns, attr = self.split_namespace(parent, k)
                if (
                    ((not has_ns or has_html_ns) and (util.lower(k) if not self.is_xml else k) == 'lang') or
                    (
                        has_ns and not has_html_ns and attr_ns == NS_XML and
                        (util.lower(attr) if not self.is_xml and attr is not None else attr) == 'lang'
                    )
                ):
                    found_lang = v
                    break
            last = parent
            parent = self.get_parent(parent, no_iframe=self.is_html)

            if parent is None:
                root = last
                has_html_namespace = self.has_html_ns(root)
                parent = last
                break

        # Use cached meta language.
        if not found_lang and self.cached_meta_lang:
            for cache in self.cached_meta_lang:
                if root is cache[0]:
                    found_lang = cache[1]

        # If we couldn't find a language, and the document is HTML, look to meta to determine language.
        if found_lang is None and (not self.is_xml or (has_html_namespace and root.name == 'html')):
            # Find head
            found = False
            for tag in ('html', 'head'):
                found = False
                for child in self.get_children(parent, no_iframe=self.is_html):
                    if self.get_tag(child) == tag and self.is_html_tag(child):
                        found = True
                        parent = child
                        break
                if not found:  # pragma: no cover
                    break

            # Search meta tags
            if found:
                for child in parent:
                    if self.is_tag(child) and self.get_tag(child) == 'meta' and self.is_html_tag(parent):
                        c_lang = False
                        content = None
                        for k, v in self.iter_attributes(child):
                            if util.lower(k) == 'http-equiv' and util.lower(v) == 'content-language':
                                c_lang = True
                            if util.lower(k) == 'content':
                                content = v
                            if c_lang and content:
                                found_lang = content
                                self.cached_meta_lang.append((root, found_lang))
                                break
                    if found_lang:
                        break
                if not found_lang:
                    self.cached_meta_lang.append((root, False))

        # If we determined a language, compare.
        if found_lang:
            for patterns in langs:
                match = False
                for pattern in patterns:
                    if pattern.match(found_lang):
                        match = True
                if not match:
                    break

        return match
1146806
function extractTitleWords(title) {
      var match = /ng([A-Z]\w*)/.exec(title);
      if ( match ) {
        title = title + ' ' + match[1].toLowerCase();
      }
      return title;
    }
543196
public function export($lang = null)
    {
        $lang = $lang ? $this->lang($lang) : $this->default;

        if (!isset($this->imported[$lang])) {
            return [];
        }

        return $this->imported[$lang];
    }
822846
def find_title(title, options = {})
      return title if title.nil? || title.empty?

      options[:scope] ||= translation_scope
      options[:default] = Array(options[:default])
      options[:default] << title if options[:default].empty?
      I18n.t(title.to_s, options)
    end
46557
public function getTitles()
    {
        $titles = array();
        $levels = array(&$titles);

        foreach ($this->nodes as $node) {
            if ($node instanceof TitleNode) {
                $level = $node->getLevel();
                $text = (string)$node->getValue();
                $redirection = $node->getTarget();
                $value = $redirection ? array($text, $redirection) : $text;

                if (isset($levels[$level-1])) {
                    $parent = &$levels[$level-1];
                    $element = array($value, array());
                    $parent[] = $element;
                    $levels[$level] = &$parent[count($parent)-1][1];
                }
            }
        }

        return $titles;
    }
549545
public static function getMetadata($lang)
	{
		$path = self::getLanguagePath(JPATH_ROOT, $lang);
		$file = $lang . '.xml';

		$result = null;

		if (is_file("$path/$file"))
		{
			$result = self::parseXMLLanguageFile("$path/$file");
		}

		if (empty($result))
		{
			return null;
		}

		return $result;
	}
58739
public function getTranslatedProperties(core_kernel_classes_Resource $instance, $lang)
    {
        $returnValue = array();

        try {
            foreach ($instance->getTypes() as $clazz) {
                foreach ($clazz->getProperties(true) as $property) {
                    if ($property->isLgDependent() || $property->getUri() == OntologyRdfs::RDFS_LABEL) {
                        $collection = $instance->getPropertyValuesByLg($property, $lang);
                        if ($collection->count() > 0) {
                            if ($collection->count() == 1) {
                                $returnValue[$property->getUri()] = (string)$collection->get(0);
                            } else {
                                $propData = array();
                                foreach ($collection->getIterator() as $collectionItem) {
                                    $propData[] = (string)$collectionItem;
                                }
                                $returnValue[$property->getUri()] = $propData;
                            }
                        }
                    }
                }
            }
        } catch (\Exception $e) {
            print $e;
        }

        return (array) $returnValue;
    }
1267842
public function getLangFallbacks( $lang ) {
		if ( self::$fallbackCache === null ) {
			// Lazy-initialize
			self::$fallbackCache = $this->fetchLangFallbacks();
		}

		$lang = $this->normalizeLang( $lang );
		return isset( self::$fallbackCache[$lang] ) ? self::$fallbackCache[$lang] : [ 'en' ];
	}
191821
public function getAlternativeTitles($title)
  {
    $builder = $this->db->builder();

    return $builder
      ->select('search.title')
      ->from([$this->table . ' as main'])
      ->join($this->table . ' as search', 'main."aniDbId" = search."aniDbId"')
      ->where('main.title = :title')
      ->queryColumn([ 'title' => $title ]);

  }