i am beginner in yii framwork
i want to change language in my project i tried but it was ineffective
i explain steps then u help me and tell my wrong
i did:
add 'sourceLanguage'=>'en_us', and 'language'=>'fa-ir' in \protected\config\main.php copy fa-ir folder fromyii\framework\messages
copy to myprojectname\protected\messages
add to myprojectname\protected\views\site below code
$lang = Yii::app()->language;
echo "my lang is:::::".$lang;
Yii::t('zii','Delete');
Yii::t('yii','Get a new code');
my language has been change but i have not any result
i think i must to clean catch files in directory
you can follow this link for guid through setting up your language support.
have you done setting up your message folder?
Change language in YII
this link is good for maintaining a language support
Related
I'm trying to get CakePHP's i18n component to work. I have extracted my strings to app/Locale/default.pot using the i18n console task. I then copied it into app/Locale/eng/LC_MESSAGES/default.po and app/Locale/fra/LC_MESSAGES/default.po making sure to change the extension. I used the program Virtaal (similar to Poedit) to translate some of the strings.
In my app/Config/core.php I have set my default language to english with Configure::write('Config.language', 'eng'); if I change it to Configure::write('Config.language', 'fra'); I expected to see the new translated strings but nothing changed. I tried setting the Config.language key in the session as well but it didn't do anything. Printing out the configure value and session values I can see they are being set.
Am I missing something here? also in the many different posts I've been reading about i18n in CakePHP I've seen the key fre being used interchangeably with fra is there a difference?
After http://book.cakephp.org/1.3/en/The-Manual/Common-Tasks-With-CakePHP/Internationalization-Localization.html it should be fre for french.
// locale path
/app/locale/fre/LC_MESSAGES/default.po (French)
// To change or set the language for your application, all you need to do is the following:
Configure::write('Config.language', 'fre');
// To set the language for the current user, store the setting in the Session object, like this:
$this->Session->write('Config.language', 'fre');
Further than that:
In our cakePHP application I have to restart the apache webserver after changing the files to get the new strings because of caching. Perhaps you have to do that too, but I'm not quite sure as we generate .mo files out of the .po via an POEdit setting. I dont't think you are forced to do this, because the cookboke doesn't say anything about that (or I didn't found it now :D ).
edit:
Looks like cake is using the bibliographic codes for french but the terminology for german. That's very confusing :/ : http://www.loc.gov/standards/iso639-2/php/code_list.php
I'm currently trying to prepare a view part into a variable but I must load the view part in a different language of the application.
I have my languages folder sets (french & english) and here what I tried with no success :
// Current language is french
$this->lang->load('[lang_file]', 'english');
$variable = $this->load->view('[path_to_view]', true);
$this->lang->load('[lang_file]');
First, is it possible to load another view in another language than the one currently in place ?
Second, if yes, what do I need to do ?
Thx.
Maybe temporary setting the language to english before loading the view file does the trick. Try this one:
$this->config->set_item('language', 'english');
$variable = $this->load->view('[path_to_view]', true);
If I'm not mistaken you should use $this->lang->load(), but maybe yours works aswell.
Bascily, yes it works. The lang keys will be overwritten, and new ones applied.
Do you have french as default language in your config/config.php?
And more importantly, is your view fetching data which the view uses before you run $this->load->language('[lang_file]', 'english');? There might be some passed errors from form_validation and simliar which will get the "wrong" language.
I have created a test module name Mytest. While saving values from the module, I am getting a blank page and it saying "Sorry! Attempt to access restricted file. " . Do anyone know, why this happening. Any help on this is really appreciating.
The most likely cause for the vTiger error “Sorry! Attempt to access restricted file.” is the $root_directory value in the ‘config.inc.php’ is incorrect or misspelled.
In order to correct it follow the steps below:
Go to your vTigerCRM directory
Open “config.inc.php” with your favorite text editor
Go to line 86 and adjust $root_directory value to correct vTiger
directory. Note, that the directory must end with /. It should look
something like this – $root_directory = ‘/var/www/vtigercrm/’;
Also there is a problem with cache memory. So do check your cache file for template files. For that go to your vTigerCRM directory.
Then Go to Smarty->templates_c.
Here you will get list of cache files. Delete this file and check weather your problem is solved or not.
Don't worry about deletion of this file.
When trying to include files from your custom module, you will get these messages because Vtiger thinks you are including these files from a location they find rather unsafe.
To avoid this error you could use the standard way a module is used in Vtiger by navigating to it like so: ......./index.php?module=Mytest&action=index. Vtiger will include your module and now there is no need for you to include CRMEntity and other data or utils related files. It should all be available this way but make sure you are using the global statement for $current_user, $current_module etc though.
Another way is to edit the following functions located in utils/CommonUtils.php:
heckFileAccessForInclusion() and checkFileAccess()
Remove or comment out the die() in these functions to fix it.
In Save.php file, just add a line.
$focus->column_fields['assigned_user_id'] = '';
before the
if($_REQUEST['assigntype'] == 'U') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif($_REQUEST['assigntype'] == 'T') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
To second what caspersky said:
Go to /include/database/PearDatabase.php and add
$adb->setDebug(true); right after $adb->connect();
I just wrote a module and received this error and it was because the record could not save because I left out:
$moduleInstance->setEntityIdentifier($fieldInstance);
Check out file permissions and file path it's trying to refer.
If you want to debug more set $adb->setDebug(true) in your index file and checkout for the errors.
A couple of things spring to mind:
Have you actually created the modules/CustomeModule directory and populated
it? (Using the template in vtlib/ModuleDir/5.4.0 and then editing the
filenames and class of CustomeModule.php)
Check the case of your module class definition, e.g. class CustomeModule
vs. class Customemodule
If you are using any version control or symlinks in the development
of your modules/Mytest code then this can trigger the "Sorry! Attempt
to access restricted file." messages.
In module setup script make sure you have added this lines.
$module->initTables();
$module->initWebservice();
Check that all language files exist.
The user module allows the admin user to configure a user's language even though the language file is not present on disk.
To quickly verify this is indeed the issue :-
- Edit the include/utils/CommonUtils.php and print the $realfilepath variable ,and comment out the die();
- In the database, "select distinct language from xxx_users";
You can fix this by downloading the required files.
As a quick fix (read:hack):-
- go to the include/language directory
- copy an existing language file as the required one. (may not always work - for example en_us to en_gb is great, but en_us to sp_es is not)
It seems you did not set write permission for Smarty folder
Probably a file is missing in your vtiger install.
To find out which one is mission you would need to edit the include/utils/CommonUtils.php file. Open it with a text editor, go around line 2755 and add the following
echo “REAL: $realfilepath, ROOT: $rootdirpath”;
Before die(Sorry....)
This would print on the screen which one is the missing file.
Sometimes this error is caused by an nonexistent module, what I mean here is that vtiger thinks you have a module but the files are not in there (might be caused by a bad migration to a new server).
Disable some modules and try again until you find which module is broken.
In my case the broken module was VGS.
I solved this on vtiger 7.3.. (maybe it works for other vesion)
I went to users permission on vtiger inside configuration settings and update tham all again with the same settings .. and got them to a more default settings .. them all users appeared back and I was able to create new users ..change password again.
I suggest logging out and maybe forcing refresh and waiting a little to make it work .
How to run Zend Project module...?
This is my project folder structure.
VIEW at $APP_DIR/application/modules/catalog/views/scripts/item/display.phtml.
CONTROLLER at $APP_DIR/application/modules/catalog/controllers/ItemController.php
BOOTSTRAP at $APP_DIR/application/Bootstrap.php
LAYOUT at $APP_DIR/application/layouts/master.phtml
FORM at $APP_DIR/library/Square/Form/Contact.php
AND LANGUAGE FILE at $APP_DIR/languages/messages.fr.php:
Please what URL should I enter in browser URL section to run this project...
I want to run ItemController...
Please help me...
By default you URL would look like http://your_domain/catalog/item/display or, maybe, like http://your_domain/fr/catalog/item/display
if your project is set up correctly you access a module like this:
example.com/module/controller/action
note: take a look at this blog on how to set-up a modular ZF application:
http://www.amazium.com/blog/create-modular-application-with-zend
I am looking to find a good way to create an http editor to manage CI language files ... ( for a custom made CMS )
I found following project but its a bit old and buggy :
http://www.mrkirkland.com/codeigniter-language-file-translator/
also it doesnt support of adding new language file and language key...
///
I am thinking of a new way for making it much easier to manage CI languages with mixing mysql and CI language files ...
there will be two tables ( lang / translations ) in the mysql table and a controller for http gui...
each time the editor finished her/his translation job her/she will click on Finish button and it will output CI language files in different languages ( but each language in a same file )
with this way We are using native CI Language system (which is fast) and managing/searching/editing of translations are much easier than directly editing CI Language files ... also its much secure ...
example :
TABLE : langs =
lang_id ---- lang_name
1---- English
2 --- German
TABLE : translations=
key --- lang_id --- translation
hello --- 1 --- hello
hello --- 2 ---hallo
and the output will be these files
/application/language/english/global_lang.php
$lang['hello'] = 'hello';
/application/language/german/global_lang.php
$lang['hello'] = 'hallo';
what is your opinion ? does it worth to do this ?
I found this:
http://blog.codebusters.pl/en/entry/codeigniter-frontend-language-files-editor
Hope this helps
:)
For php language file editing I'm using this Firefox addon: https://addons.mozilla.org/en-US/firefox/addon/phplangeditor/
It's easy to find untranslated strings...