Laravel: Whole lang files in on view - laravel

I want to localize my Laravel app.
I call it on blade like this: #lang('bot.bots')
But my view I got this:
My bot.php is:
<?
return [
'bots' => 'Bot|Bots',
'addBot' => 'Add bot',
'editBot' => 'Edit bot',
'deleteBot' => 'Delete bot',
'compose' => 'Compose',
'addGroup' => 'Add group',
'editGroup' => 'Edit group',
'deleteGroup' => 'Delete group',
'confirmDeleteGroup' => 'Are you sure you want to delete the group?',
'textRecognition' => 'Text recognition',
'newRule' => 'Add rule',
'deleteRule' => 'Delete rule',
'confirmDeleteRule' => 'Are you sure you want to delete the rule?',
'editBot' => 'Bot szerkesztése',
'input' => 'Input',
'output' => 'Output',
'addInput' => 'Add input',
'addOutput' => 'Add output',
'blocks' => 'Block|Blocks',
'groups' => 'Group|Groups',
'text' => 'Text',
'broadcast' => 'Broadcast',
'analytics' => 'Analytics',
'chatPartners' => 'Chat Partners',
];
What can be the problem? I did everything like what's in the documentation

Just indicate the count like this
$bots_count = 4 //replace with count
#lang('bot.bots', $bots_count)
You may also use translation choices, for which your array would look like this
return [
'bots' => '{0} No Bots|{1} Bot|[2,*] Bots',
...
];

Related

Where is the file after create by "$service->spreadsheets->create($requestBody)"

Thank you very much for reading this, its quite long!
I run my function:
public function createSpreadSheet()
{
$client = $this->getClient();
$service = new \Google_Service_Sheets($client);
// TODO: Assign values to desired properties of `requestBody`:
$requestBody = new \Google_Service_Sheets_Spreadsheet();
$response = $service->spreadsheets->create($requestBody);
echo '<pre>', var_export($response, true), '</pre>', "\n";
}
I got a result:
Google_Service_Sheets_Spreadsheet::__set_state(array(
'collection_key' => 'sheets',
'developerMetadataType' => 'Google_Service_Sheets_DeveloperMetadata',
'developerMetadataDataType' => 'array',
'namedRangesType' => 'Google_Service_Sheets_NamedRange',
'namedRangesDataType' => 'array',
'propertiesType' => 'Google_Service_Sheets_SpreadsheetProperties',
'propertiesDataType' => '',
'sheetsType' => 'Google_Service_Sheets_Sheet',
'sheetsDataType' => 'array',
'spreadsheetId' => '1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU',
'spreadsheetUrl' => 'https://docs.google.com/spreadsheets/d/1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU/edit',
'internal_gapi_mappings' =>
array (
),
modelData' =>
array (
),
'processed' =>
array (
),
'properties' =>
Google_Service_Sheets_SpreadsheetProperties::__set_state(array(
'autoRecalc' => 'ON_CHANGE',
'defaultFormatType' => 'Google_Service_Sheets_CellFormat',
'defaultFormatDataType' => '',
'iterativeCalculationSettingsType' => 'Google_Service_Sheets_IterativeCalculationSettings',
'iterativeCalculationSettingsDataType' => '',
'locale' => 'en_US',
'timeZone' => 'Etc/GMT',
'title' => 'Untitled spreadsheet',
'internal_gapi_mappings' =>
array (
),
'modelData' =>
array (
),
'processed' =>
array (
),
'defaultFormat' =>
Google_Service_Sheets_CellFormat::__set_state(array(
'backgroundColorType' => 'Google_Service_Sheets_Color',
'backgroundColorDataType' => '',
'bordersType' => 'Google_Service_Sheets_Borders',
'bordersDataType' => '',
'horizontalAlignment' => NULL,
'hyperlinkDisplayType' => NULL,
'numberFormatType' => 'Google_Service_Sheets_NumberFormat',
'numberFormatDataType' => '',
.........
.........
))
I access to the link it returned:
'https://docs.google.com/spreadsheets/d/1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU/edit'
it gives me this 'request access' page, then I press the request access
I open my email and get this:
Your message wasn't delivered to xxxxxx#xxxxxxxx.iam.gserviceaccount.com because the domain admanager-1x3x71x4x27x4.iam.gserviceaccount.com couldn't be found. Check for typos or unnecessary spaces and try again.
Is there something wrong and what should I do? I just want to open the file and check where it is.
Thank you very much!

How to add the alt and title fields in an image field of a custom entity in drupal 8

I created a custom entity with an image field. But I can not display the alt and title fields.
Here is my code:
$fields['main_img'] = BaseFieldDefinition::create('image')
->setLabel(t('Main image of the hardware'))
->setSettings([
'file_directory' => 'hardware',
'file_extensions' => 'png jpg jpeg',
])
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'image',
'weight' => -30,
))
->setDisplayOptions('form', array(
'label' => 'above',
'type' => 'image_image',
'weight' => -30,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
Could you tell me how to display the alt and title fields of my image and maybe someone knows where the documentation is for doing that because I can not find it?
Thank you all
I loaded one of my node field definitions with $node->getFieldDefinitions():
I believe you can try something like this:
->setDisplayOptions('form', array(
'label' => 'above',
'type' => 'image_image',
'weight' => -30,
'settings' => [
'alt_field' => TRUE,
'alt_field_required' => TRUE, //optional
'title_field' => TRUE,
'title_field_required' => TRUE, //optional
],
))
Thank Dmytro.
I feel a little stupid but it's life.
It was enough to add 'alt_field_required' => FALSE and 'title_field' => TRUE in setSettings.
But as title and alt is displayed that when we download an image I thought it did not work.
A day of lost!

How to add elements to a fieldset in magento horizontally rather than vertically

I am adding few check boxes in to magento using the fieldset option like the following.
$fieldset = $form->addFieldset('display', array(
'legend' => $helper->__('Schedule Sales Order Transfer'),
'class' => 'fieldset-wide'
));
for($i=01; $i*5<60; $i++){
$time = $i*5;
$fieldset->addField('min'.$time, 'checkbox', array(
'name' => 'Checkbox',
'checked' => false,
'onclick' => self::setAll("min"),
'onchange' => "",
'value' => ''.$time,
'disabled' => false,
'after_element_html' => '<small>'.$time.'</small>',
'tabindex' => 1
));
}
By doing so, all the check boxes are coming one below another. Is it possible to make it one adjacent to another i.e., horizontally?
Anybody Please suggest the solution ASAP...
Thank you,
In your Code return like <tr>...</tr><tr>..</tr>, so if you need to add custom css or js to achieve what you expected,
or
for($i=01; $i*5<60; $i++){
$time[$i]['value'] = $i*5;
$time[$i]['label'] = $i*5;
}
$fieldset->addField('Time', 'checkboxes', array(
'label' => $this->__('Time'),
'name' => 'time[]',
'values' => $time,
'value' => '1',
'tabindex' => 1
));
its return like <tr><td>label</td><td>value<ul><li></li>....<li></li></ul></td></tr>
then you continue your stuff.,
Note: I'm just suggest the possible ways

How to echo config item from config file for view in Codeigniter?

How to call config item from config file for view in codeigniter.
here is my config file
$config['user'] = array(
'email_validation' => 'email validation',///^([\w-]+(?:\.[\w-]+)*)#((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
'no_permission' => '/',
'admin_group' => 'admin',
'default_group' => 'default',
'public_group' => 'public',
'users' => 'aauth_users',
'groups' => 'aauth_groups',
'user_to_group' => 'aauth_user_to_group',
'perms' => 'aauth_perms',
'perm_to_group' => 'aauth_perm_to_group',
'perm_to_user' => 'aauth_perm_to_user',
'pms' => 'aauth_pms',
'system_variables' => 'aauth_system_variables',
'user_variables' => 'aauth_user_variables',
'remember' => ' +3 days',
'max' => 13,
'valid_chars' => array(' ', '\''),
'ddos_protection' => true,
'recaptcha_active' => false,
'recaptcha_login_attempts' => 4,
'recaptcha_siteKey' => '',
'recaptcha_secret' => '',
'max_login_attempt' => 10,
'verification' => false,
'email' => 'admin#admin.com',
'name' => 'Emre Akay'
);
Here is my load config
$this->config->load('user');
And I will view its item for view as below
$site_name = $this->config->item('email_validation');
But is don't show any thing
This is because your config array is two dimensional array. So, you can't access directly email_validation without getting user first. Moreover,
$this->config->load('user'); just means loading user.php from application/config/ directory. Doesn't mean loading user index from $config array. You can do it like that.
$userConfig = $this->config->item('user');
echo $userConfig["email_validation"];
Edit
Please make sure you config file is under application/config/ and loaded.
$this->config->load('user');
You can check which config is loaded by doing like this.
echo "<pre>";
print_r($this->config);
echo "</pre>";
Hope it will be useful for you.
if your php version>=5.4 you can use this
$site_name = $this->config->item('user')['email_validation']

Magento AvS_fastsimpleimporter multiple addresses

Is it possible while creating new users with AvS_Fastsimpleimporter to add more than the standard address ?
Currently my array "data" looks like this
'email' => $kunde['email'],
'_website' => $_website,
'_store' => $_website . 'store',
'confirmation' => '',
'created_at' => $created_at,
'created_in' => 'Import',
'disable_auto_group_change' => 0,
'firstname' => $kunde['name_1'],
'group_id' => 3,
'kontonummer' => $kunde['kontonr'],
'kundennummer' => $kunde['kundennr'],
'lastname' => $lastname,
'password_hash' => $password_hash,
'store_id' => 0,
'website_id' => $country['id'],
'_address_city' => $kunde['ort'],
'_address_country_id' => $kunde['land'],
'_address_fax' => $kunde['fax'],
'_address_firstname' => $kunde['name_1'],
'_address_lastname' => $lastname,
'_address_postcode' => $kunde['plz'],
'_address_street' => $kunde['strasse'],
'_address_telephone' => $_address_telephone,
'_address_vat_id' => $kunde['ust_id'],
'_address_default_billing_' => 1,
'_address_default_shipping_' => 1,
And i want to add a second address with the AvS_Simpleimporter.
I tried to add a second array in data like this:
array_push($data, array(
'email' => null,
'_website' => null,
'_address_city' => checkRequiredInput($address['ort']),
'_address_country_id' => $address['land'],
'_address_firstname' => checkRequiredInputVadr($address['name_1']),
'_address_lastname' => checkRequiredInputVadr($address['name_2']),
'_address_postcode' => checkRequiredInput($address['plz']),
'_address_street' => checkRequiredInput($address['strasse']),
'_address_default_billing_' => 0,
'_address_default_shipping_' => 0,
));
And then executing with
$importer = Mage::getModel('fastsimpleimport/import');
$importer->setIgnoreDuplicates('password_hash')->processCustomerImport($data);
But this currently doesn't work. The second address is added as an extra array to data like this
.... data array
....
'_address_default_billing_' => 1
'_address_default_shipping_' => 1
[0] => 'email' => bla bla
'_website' => bla bla
and so son
Any help ?
Multiple addresses are imported as additional rows. Hence you need to:
'_address_country_id' => array($country1,$country2),
'_address_city' => array($city1, $city2),
....

Resources