I am using cake i18n,
when it creates the file default.pot there are also strings of the plugin.
How make to exclude the folder plugin from cake i18n?
The good solution will be using __d() function with prefix of name of plugin.
or
In CakePHP i18n shell You can exclude folders.
Related
i wrote a plugin (AdminView) as a theme and i want to localize it.
i generate pot file using
bin\cake i18n extract --plugin AdminView
the pot file created by bake at
root/plugins/AdminView/src/Locale/default.pot
i moved it to
root/plugins/AdminView/src/Locale/fa_IR/default.po
and i set the locale to fa_IR
but cakephp dose not load it .
but when i move files to the
root/src/Locale/fa_IR/default.po
it loads perfectly.
the question is how can i load po files in the plugins directory ?
i cleared the root/tmp/cache/persistent every time i test
As mentioned in the comments, plugins cannot provide messages for the default domain unless their paths are included in your apps App.paths.locales config, or a custom loader is being defined for the default domain.
By default, plugins provide translations for their respective plugin domain, ie for AdminView that would be admin_view (admin_view.po or .mo accordingly), and you'd use it like __d('admin_view', 'message').
If all your translation function calls are inside of the plugins, then you should probably stick to the convention, and use the respective plugin domains, which you can always override at application level, or provide fallbacks for in your app level default.po.
See also
Cookbook > Internationalization & Localization > Language Files
Cookbook > Internationalization & Localization > Using Translation Functions
I am using Sonar in a Angular Application for the front part.
I have many js files in my application, but i need that the Sonar ignore or exclusion my js files that ending in .spec.js, are tests unit of Angular.
I have many folders under "src/app" and inside i have many folders with the .spec.js files .
In the properties file to Sonar (sonar-project.properties), I think I can use:
sonar.test.exclusions=src/app/*.spec.js
or
sonar.exclusions=src/app/*.spec.js
But I'm not sure, in what format is the value of property.
Thanks,
Yes, you are correct. You can use the sonar.exclusions property to exclude source files from analysis and the sonar.test.exclusions property to exclude unit tests. You should pass a comma-delimited list of file path patterns to these properties.
I suggest you refer to this topic to learn how to specify path patterns. Say, if you need to exclude all the .spec.js files from all the src/app directories, use this pattern:
**/src/app/*.spec.js
I always use */*.jsand it works for me for file in main dir. So just use * or ** to navigate inside your project dir.
I'm trying to change locale in the plugin that is used as a theme.In my AppController I set the locale with:
I18n::locale('bs');
And in the plugin that is named 'Admin' I place the translation file in this location:
Admin
/src
/Locale
/bs
admin.po
Locale does seem to change, but it doesn't fetch the translations from the translation file. What could be the problem?
The problem was I wasn't using domain name while translating strings. You need to use __d() with the name of your plugin as the domain.
I want to use some CakePHP plugins such as CakeGrid in Croogo 2.
How can i do it?
Cheers
Try:
Open file Config/bootstrap.php and Add code end of file
CakePlugin::load('CakeGrid');
Then add changes according to instruction in croogo controller and view file.
can anyone tell me how to include a js Library within a CakePHP Plugin ?
In the root app/ folder I can do it in the Config/assets.php but where do I include it in a Plugin ?
The Library which I want to include is located in /app/Plugin/MyModule/webtoor/js/lib/
You can use blocks for scripts and CSS files. More info here: http://book.cakephp.org/2.0/en/views.html#using-blocks-for-script-and-css-files
Short answer:
// in your view
$this->Html->script('/pluginName/js/lib/whatever', array('block' => 'scriptBottom'));
// in your layout
echo $this->fetch('scriptBottom');
This should do the trick.