当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_L10N::getLanguageCode方法代码示例

本文整理汇总了PHP中OC_L10N::getLanguageCode方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_L10N::getLanguageCode方法的具体用法?PHP OC_L10N::getLanguageCode怎么用?PHP OC_L10N::getLanguageCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_L10N的用法示例。


在下文中一共展示了OC_L10N::getLanguageCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNotificationTypes

 /**
  * @param \OC_L10N $l
  * @return array Array "stringID of the type" => "translated string description for the setting"
  */
 public function getNotificationTypes(\OC_L10N $l)
 {
     if (isset($this->notificationTypes[$l->getLanguageCode()])) {
         return $this->notificationTypes[$l->getLanguageCode()];
     }
     $notificationTypes = array(self::TYPE_SHARED => $l->t('A file or folder has been <strong>shared</strong>'), self::TYPE_SHARE_CREATED => $l->t('A new file or folder has been <strong>created</strong>'), self::TYPE_SHARE_CHANGED => $l->t('A file or folder has been <strong>changed</strong>'), self::TYPE_SHARE_DELETED => $l->t('A file or folder has been <strong>deleted</strong>'), self::TYPE_SHARE_RESTORED => $l->t('A file or folder has been <strong>restored</strong>'));
     // Allow other apps to add new notification types
     $additionalNotificationTypes = $this->activityManager->getNotificationTypes($l->getLanguageCode());
     $notificationTypes = array_merge($notificationTypes, $additionalNotificationTypes);
     $this->notificationTypes[$l->getLanguageCode()] = $notificationTypes;
     return $notificationTypes;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:16,代码来源:data.php

示例2: translation

 /**
  * @brief Translate an event string with the translations from the app where it was send from
  * @param string $app The app where this event comes from
  * @param string $text The text including placeholders
  * @param array $params The parameter for the placeholder
  * @param bool $stripPath Shall we strip the path from file names?
  * @param bool $highlightParams Shall we highlight the parameters in the string?
  *             They will be highlighted with `<strong>`, all data will be passed through
  *             \OCP\Util::sanitizeHTML() before, so no XSS is possible.
  * @return string translated
  */
 public function translation($app, $text, $params, $stripPath = false, $highlightParams = false)
 {
     if (!$text) {
         return '';
     }
     if ($app === 'files') {
         $preparedParams = $this->parameterHelper->prepareParameters($params, $this->parameterHelper->getSpecialParameterList($app, $text), $stripPath, $highlightParams);
         switch ($text) {
             case 'created_self':
                 return $this->l->t('You created %1$s', $preparedParams);
             case 'created_by':
                 return $this->l->t('%2$s created %1$s', $preparedParams);
             case 'created_public':
                 return $this->l->t('%1$s was created in a public folder', $preparedParams);
             case 'changed_self':
                 return $this->l->t('You changed %1$s', $preparedParams);
             case 'changed_by':
                 return $this->l->t('%2$s changed %1$s', $preparedParams);
             case 'deleted_self':
                 return $this->l->t('You deleted %1$s', $preparedParams);
             case 'deleted_by':
                 return $this->l->t('%2$s deleted %1$s', $preparedParams);
             case 'shared_user_self':
                 return $this->l->t('You shared %1$s with %2$s', $preparedParams);
             case 'shared_group_self':
                 return $this->l->t('You shared %1$s with group %2$s', $preparedParams);
             case 'shared_with_by':
                 return $this->l->t('%2$s shared %1$s with you', $preparedParams);
             case 'shared_link_self':
                 return $this->l->t('You shared %1$s via link', $preparedParams);
         }
     }
     // Allow other apps to correctly translate their activities
     $translation = $this->activityManager->translate($app, $text, $params, $stripPath, $highlightParams, $this->l->getLanguageCode());
     if ($translation !== false) {
         return $translation;
     }
     $l = Util::getL10N($app);
     return $l->t($text, $params);
 }
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:51,代码来源:datahelper.php

示例3: addTranslations

	/**
	 * add a translation JS file
	 *
	 * @param string $application application id
	 * @param string $languageCode language code, defaults to the current language
	 */
	public static function addTranslations($application, $languageCode = null) {
		if (is_null($languageCode)) {
			$l = new \OC_L10N($application);
			$languageCode = $l->getLanguageCode($application);
		}
		if (!empty($application)) {
			$path = "$application/l10n/$languageCode";
		} else {
			$path = "l10n/$languageCode";
		}
		if (!in_array($path, self::$scripts)) {
			self::$scripts[] = $path;
		}
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:20,代码来源:util.php

示例4: addTranslations

 /**
  * add a translation JS file
  *
  * @param string $application application id
  * @param string $languageCode language code, defaults to the current language
  */
 public static function addTranslations($application, $languageCode = null)
 {
     if (is_null($languageCode)) {
         $l = new \OC_L10N($application);
         $languageCode = $l->getLanguageCode($application);
     }
     if (!empty($application)) {
         self::$scripts[] = "{$application}/l10n/{$languageCode}";
     } else {
         self::$scripts[] = "l10n/{$languageCode}";
     }
 }
开发者ID:Romua1d,项目名称:core,代码行数:18,代码来源:util.php


注:本文中的OC_L10N::getLanguageCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。