Overview

Namespaces

  • Cron
  • None

Classes

  • _HtmlGrid_TableOut
  • _TransactionModel_RawSaveOperation
  • AccessControlComponent
  • AccessControlHelper
  • ActionListHelper
  • ActiveDirectoryUtils
  • AddCurrentPidToSchedulingShellCallLogs
  • AnonymousFunctionOperation
  • ArrayUtil
  • AssociationIntegrityBehavior
  • AtomicOperation
  • AuthenticationComponent
  • AuthenticationController
  • AuthenticationUser
  • AutocompleteDatasourceComponent
  • BaseModelComponent
  • Basics
  • CakeLayersHelper
  • CheckAndRunShell
  • ClassSearcher
  • CommandLineUtil
  • CommonValidationBehavior
  • ConfigurableShellCallsSchedulingTask
  • ConfigurationKey
  • ConfigurationKeys
  • ConfigurationKeysController
  • Context
  • ContextComponent
  • ContextHelper
  • Contexts
  • ControllerInspector
  • ControllerMenuHelper
  • CreateJournalingTables
  • CreateTableConfigurationKeys
  • CreateTableSchedulingConfigurableShellCalls
  • CreateTableSchedulingShellCallLogs
  • CreateTableSettedConfigurationKeys
  • CreateTableUserResetPasswordRequests
  • CreateTableUsers
  • CronSchedulingInstaller
  • CronValidationBehavior
  • CssBox
  • CssController
  • CssProperties
  • CssShell
  • CsvUtil
  • CustomDataModel
  • DatasourceDumperManager
  • DateTimeInput
  • DependencyShell
  • DetailHelper
  • DumperShell
  • ExtendedFieldsAccessControl
  • ExtendedFieldSet
  • ExtendedFieldSetHelper
  • ExtendedFieldsParser
  • ExtendedFormHelper
  • ExtendedHasManyAppModel
  • ExtendedOperationsBehavior
  • FieldDefinition
  • FieldRowDefinition
  • FieldSetDefinition
  • FieldSetLayoutHelper
  • FileOperations
  • FileOperations_Rename
  • FileOperations_SymLink
  • FileOperations_Touch
  • FileOperations_Unlink
  • FileSystem
  • FixConfigurationKeysPrimaryKey
  • FixSettedConfigurationKeysPrimaryKey
  • HasManyUtilsBehavior
  • HtmlDocument
  • HtmlGrid
  • HtmlGrid_Cell
  • HttpClient
  • HttpResponse
  • ImapClient
  • ImapMailBox
  • ImapParserShell
  • IncludePath
  • InputMasked
  • InputSearchable
  • InputsOnSubmit
  • InstallShell
  • JenkinsBuildShell
  • Journal
  • JournalDetail
  • JournalizedBehavior
  • JsonResponseComponent
  • LayoutsHelper
  • Ldap
  • LdapUtils
  • ListFieldSet
  • ListFieldSetHelper
  • ListsHelper
  • MailParser
  • Make
  • MenuHelper
  • MigrationAllPluginsShell
  • ModelOperations
  • ModelOperations_Delete
  • ModelOperations_Save
  • ModelTraverser
  • MysqlDumper
  • OpenLdapUtils
  • PaginatorUtilComponent
  • PaginatorUtilComponentFilter
  • PaginatorUtilHelper
  • Plugin
  • PluginManager
  • Reflections
  • RenameEnabledToActiveFromUsersTable
  • RunShellCallShell
  • ScaffoldUtilComponent
  • ScaffoldUtilHelper
  • Scheduling
  • SchedulingConfigurableShellCall
  • SchedulingConfigurableShellCallsController
  • SchedulingShellCallLog
  • SchedulingShellCallLogsController
  • SettedConfigurationKey
  • StuffreposPluginsRename
  • TimeZoneBehavior
  • TransactionModel
  • TransactionOperation
  • Translator
  • TranslatorShell
  • User
  • UserAuthenticationComponent
  • UserChangePassword
  • UserResetPassword
  • UserResetPasswordRequest
  • UserResetPasswordRequestSubmission
  • UsersController
  • ViewUtilHelper

Interfaces

  • AccessControlFilter
  • CommitableOperation
  • DatasourceDumper
  • MakeListener
  • SchedulingInstaller
  • TasksObject
  • UndoableOperation

Exceptions

  • LdapObjectNotWritableException
  • ModelTraverserException
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: class Translator {
 4: 
 5:     public static function termsToTranslate() {
 6:         $terms = array();
 7:         foreach (self::_findModels() as $model) {
 8:             $terms[$model->plugin] = empty($terms[$model->plugin]) ?
 9:                     self::_modelTerms($model) :
10:                     array_merge($terms[$model->plugin], self::_modelTerms($model));
11:         }
12:         $ret = array();
13:         foreach ($terms as $plugin => $pluginTerms) {
14:             $ret[$plugin] = self::_uniqueTerms($pluginTerms);
15:         }
16:         ksort($ret);
17:         return $ret;
18:     }
19: 
20:     private static function _uniqueTerms($terms) {
21:         $ret = array_unique($terms);
22:         sort($ret);
23:         return $ret;
24:     }
25: 
26:     /**
27:      * 
28:      * @param \Model $model
29:      * @return string[]
30:      */
31:     private static function _modelTerms(\Model $model) {
32:         $terms = array(
33:             $model->name,
34:             preg_replace('/([a-z])([A-Z])/', '\1 \2', $model->name),
35:             Inflector::pluralize($model->name),
36:             Inflector::pluralize(
37:                     preg_replace('/([a-z])([A-Z])/', '\1 \2', $model->name)),
38:         );
39:         if (is_array($model->schema())) {
40:             foreach (array_keys($model->schema()) as $field) {
41:                 $terms[] = Inflector::humanize(preg_replace('/_id$/', '', $field));
42:             }
43:         }
44:         foreach (array_keys($model->virtualFields) as $field) {
45:             $terms[] = Inflector::humanize(preg_replace('/_id$/', '', $field));
46:         }
47:         if (method_exists($model, 'toTranslation')) {
48:             $terms = array_merge($terms, $model->toTranslation());
49:         }
50:         return $terms;
51:     }
52: 
53:     /**
54:      * 
55:      * @return \Model[]
56:      */
57:     private static function _findModels() {
58:         $models = array();
59:         foreach (App::objects('model') as $modelName) {
60:             if ($modelName != 'AppModel') {
61:                 App::import('Model', $modelName);
62: 
63:                 $class = new ReflectionClass($modelName);
64:                 if (!$class->isAbstract()) {
65:                     $models[] = $class->newInstance();
66:                 }
67:             }
68:         }
69:         return $models;
70:     }
71: 
72: }
73: 
API documentation generated by ApiGen 2.8.0