Cakephp 3 - Plugin - translation file - not working - cakephp

Using Cake version 3.4.5 :
1) I've wrote a plugin :
/plugins/Accounting/
2) then, to create the pot file from the view files I run :
bin/cake i18n extract --plugin Accounting
3) this generates /plugins/Accounting/src/Locale/default.pot
But the translated text does not appear.
My locale is es_AR, and I've tried to copy the file as :
/plugins/Accounting/src/Locale/accounting.pot
or
/plugins/Accounting/src/Locale/es_AR/default.pot
or
/plugins/Accounting/src/Locale/es_AR/accounting.pot
Also tried to save the files as accounting.po, but nothing happens
But still not text is translated from the plugin views (it does work for the app's views).

I've found it !!!
The problem was the file / directory permissions.
By default, cake i18n extract --plugin MyPlugin makes this :
creates the src/Locale/ directory inside the plugin structure
creates the template translation file default.pot instead of
my_plugin.pot
all these creations are made with mode 750 being
the owner the linux user currently logged in ( not www-data )
So in order to make it work :
change the permissions of the Locale structure to 755
rename default.pot to my_plugin.po
use __d( 'my_plugin', 'Text to be translated' )

Related

How to make nuget package:moderenwpfui generate only needed language files.(WPF project)

How to make nuget package:moderenwpfui generate only needed language files.
The repository for this nuget package is https://github.com/Kinnara/ModernWpf .
When I generate my app, a lot of language files will be generated. Is there a way to generate only the language I need or preset the language file to the language I use?
The following are all the files generated in the Debug directory, the one without the suffix is the folder, the folder contains the dll library for the language files
af-ZA
am-ET
ar-SA
az-Latn-AZ
be-BY
bg-BG
bn-BD
bs-Latn-BA
ca-ES
cs-CZ
da-DK
de-DE
dotnetCampus.FileDownloader.dll
el-GR
en-GB
es-ES
es-MX
et-EE
eu-ES
fa-IR
fi-FI
file
fr-CA
fr-FR
gl-ES
ha-Latn-NG
he-IL
hi-IN
hr-HR
hu-HU
ICSharpCode.SharpZipLib.dll
ICSharpCode.SharpZipLib.pdb
id-ID
is-IS
it-IT
ja-JP
ka-GE
kk-KZ
km-KH
kn-IN
ko-KR
lo-LA
lt-LT
lv-LV
Microsoft.Web.WebView2.Core.dll
Microsoft.Web.WebView2.WinForms.dll
Microsoft.Web.WebView2.Wpf.dll
mk-MK
ml-IN
ModernWpf.Controls.dll
ModernWpf.dll
ms-MY
nb-NO
nl-NL
nn-NO
myapp.exe
myapp.exe.config
myapp.pdb
myapp.xml
pl-PL
pt-BR
pt-PT
ro-RO
ru-RU
runtimes
sk-SK
sl-SI
sq-AL
sr-Latn-RS
sv-SE
sw-KE
System.Drawing.Common.dll
System.ValueTuple.dll
ta-IN
te-IN
th-TH
tr-TR
uk-UA
uz-Latn-UZ
vi-VN
WPFUI.dll
zh-CN
zh-TW
Under Project>References you will find ModernWpf and ModernWpf.Controls. You need to set the property Copy Local to False for both of them.
Before you do that, backup these files and copy them manually to debug folder after doing the above steps.
ModernWpf.Controls.dll
ModernWpf.dll
You will get errors if you don't do this.

Image Extractor by AI Habitat produces a configuration error when importing Matterport dataset

I need help understanding the error message, which is along the lines of changing the file name to json because the configuration fails. I have a long error message but pasted the part that is mostly repeated throughout the message:
/Users/kyra/Documents/GitHub/habitat-sim/matterport/scans/house1/8194nk5LbLH 13/poisson_meshes/8194nk5LbLH_10.stage_config.json
I0412 19:04:17.735939 42397184 AttributesManagerBase.h:296] AttributesManager::createFromJsonOrDefaultInternal (Stage) : Proposing JSON name : /Users/kyra/Documents/GitHub/habitat-sim/matterport/scans/house1/8194nk5LbLH 13/poisson_meshes/8194nk5LbLH_10.stage_config.json from original name : /Users/kyra/Documents/GitHub/habitat-sim/matterport/scans/house1/8194nk5LbLH 13/poisson_meshes/8194nk5LbLH_10.ply | This file does not exist.
I0412 19:04:17.736085 42397184 AbstractObjectAttributesManagerBase.h:182] AbstractObjectAttributesManager::createObject (Stage) : Done making attributes with handle : /Users/kyra/Documents/GitHub/habitat-sim/matterport/scans/house1/8194nk5LbLH 13/poisson_meshes/8194nk5LbLH_10.ply
I0412 19:04:17.736093 42397184 AbstractObjectAttributesManagerBase.h:189] File (/Users/kyra/Documents/GitHub/habitat-sim/matterport/scans/house1/8194nk5LbLH 13/poisson_meshes/8194nk5LbLH_10.ply) exists but is not a recognized config filename extension, so new default Stage attributes created and registered.
I0412 19:04:17.736124 42397184 SceneDatasetAttributes.cpp:46]
What I did: Ran image extractor after activating Conda env. I modified the image extractor to change the file path to point to a .ply file in the matterport dataset.
Setup: 1)Facebook's AI Habitat-sim built from source,
2)MacBook Air M1,
3)Conda environment with the dependencies (using pip install -r requirements.txt) but habitat-sim is not installed by Conda,
4)Matterport3D dataset (downloaded one house).
Thank you.

Rundeck - Failed to read SSH Private Key stored at path - Path does not exist

I am running the Rundeck war file directly
java -jar rundeck-3.0.17-20190311.war
I get this error message when I trigger a build.
Failed to read SSH Private key stored at path:
keys/rundeck.pem: org.rundeck.storage.api.StorageException:
Path does not exist: keys/rundeck.pem
Failed: ConfigurationFailure: Failed to read SSH
Private key stored at path: keys/rundeck.pem
It makes sense that the reference in the Default Node Executor is invalid and that Rundeck cannot find the .pem file.
I've tried
referencing the full working directory (/home/user/rundeck/keys/rundeck.pem) It wants the location to start with keys/.
referencing it to its relative path (keys/rundeck.pem)
copied the keys directory to /home/user/
In desperation, I ran chmod 700 on the pem file.
Most of the questions and examples I found were on older versions of Rundeck.
I'd like to know where the .pem file must be configured and how it should be referenced. Any other information that could help me configure the SSH keys will be appreciated.
You must add the key using the GUI and use the path that you are defined in your resources.xml.
For add your key, you can follow this. Although the video is based on Rundeck 2.x it is valid for Rundeck 3.x:
Check that https://www.youtube.com/watch?v=qOA-kWse22g
And for generate your resources.xml file select your new project and go to Project Settings > Edit Nodes > Click on "Configure Nodes" button (up to right) > Click on "Add Sources +" Button > Select "+ File" option > in "Format" field select "resourcexml" and fill the path in "File Path" field (put the file name at the end, usually "resources.xml"), then select "Generate", "Include Server Node" and "Writeable" checkboxes and click on "Save" button.

Prepare multi-databases with play framework

I want to prepare my application to be compatible with many databases types. To try it i've used H2, MySql and Postgresql. So 'ive added into build.sbt :
"mysql" % "mysql-connector-java" % "5.1.35",
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41"
and i've added conf/prod.conf with all configuration without database configuration, and 3 files:
conf/h2.conf
include "prod.conf"
db.h2.driver=org.h2.Driver
db.h2.url="jdbc:h2:mem:dontforget"
db.h2.jndiName=DefaultDS
ebean.h2="fr.chklang.dontforget.business.*"
conf/mysql.conf
include "prod.conf"
db.mysql.driver=com.mysql.jdbc.Driver
db.mysql.jndiName=DefaultDS
ebean.mysql="fr.chklang.dontforget.business.*"
conf/postgresql.conf
include "prod.conf"
db.postgresql.driver=org.postgresql.Driver
db.postgresql.jndiName=DefaultDS
ebean.postgresql="fr.chklang.dontforget.business.*"
Add to it i've three folders into conf/evolutions with
evolutions/h2
evolutions/mysql
evolutions/postgresql
with these things user can start my application with this command :
-Dconfig.file=dontforget-conf.conf -DapplyEvolutions.default=true -Dhttp.port=10180 &
And this conf file is
include "postgresql.conf"
db.postgresql.url="jdbc:postgresql:dontforget"
db.postgresql.user=myUserName
db.postgresql.password=myPassword
But with this configuration, when my application try to connect to DB :
The default EbeanServer has not been defined? This is normally set via the ebean.datasource.default property. Otherwise it should be registered programatically via registerServer()]]
So i've tried to add, into my configuration :
ebean.datasource.default=postgresql
but when i add it i've :
Configuration error: Configuration error[Configuration error[]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94)
at play.api.Configuration.reportError(Configuration.scala:743)
at play.Configuration.reportError(Configuration.java:310)
at play.db.ebean.EbeanPlugin.onStart(EbeanPlugin.java:56)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at scala.collection.immutable.List.foreach(List.scala:383)
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.api.Play$.start(Play.scala:90)
at play.core.StaticApplication.<init>(ApplicationProvider.scala:55)
at play.core.server.NettyServer$.createServer(NettyServer.scala:253)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:289)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:284)
at scala.Option.map(Option.scala:145)
at play.core.server.NettyServer$.main(NettyServer.scala:284)
at play.core.server.NettyServer.main(NettyServer.scala)
Caused by: Configuration error: Configuration error[]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94)
at play.api.Configuration.reportError(Configuration.scala:743)
at play.api.db.BoneCPApi.play$api$db$BoneCPApi$$error(DB.scala:271)
at play.api.db.BoneCPApi$$anonfun$getDataSource$3.apply(DB.scala:438)
at play.api.db.BoneCPApi$$anonfun$getDataSource$3.apply(DB.scala:438)
at scala.Option.getOrElse(Option.scala:120)
at play.api.db.BoneCPApi.getDataSource(DB.scala:438)
at play.api.db.DB$$anonfun$getDataSource$1.apply(DB.scala:142)
at play.api.db.DB$$anonfun$getDataSource$1.apply(DB.scala:142)
at scala.Option.map(Option.scala:145)
at play.api.db.DB$.getDataSource(DB.scala:142)
at play.api.db.DB.getDataSource(DB.scala)
at play.db.DB.getDataSource(DB.java:25)
at play.db.ebean.EbeanPlugin.onStart(EbeanPlugin.java:54)
So i don't understand how i can do it.
YES!!! I've found it! After debug mode (etc...)
There was 2 problems.
First problem : I must add a key into my application.conf :
ebeanconfig.datasource
For me (for exemple), postgresql.conf is modified to :
db.postgresql.driver=org.postgresql.Driver
db.postgresql.jndiName=DefaultDS
ebean.postgresql="fr.chklang.dontforget.business.*"
ebeanconfig.datasource.default=postgresql
Second problem : include into play 2.3.x don't works because conf folder isn't added into classpath (ref Load file from '/conf' directory on Cloudbees ) so we must concat prod.conf, postgresql.conf and dontforget.conf into an only single file.
I hope i have helped any other developper...

AssetCompress for CakePHP 1.3

I'm using AssetCompress v0.5 from the 1.3 branch and the dynamic built is not working. I've done the following so far:
Downloaded and copied the asset_compress folder into my app/plugins folder
Copied the config.ini and renamed it to app/config/asset_compress.ini
Created 2 CSS and JS bundles named public and logged (so 4 in total)
Added AssetCompress.AssetCompress in my $helpers array in my AppController
Changed my default.ctp layout file to: echo $this->AssetCompress->css('public'); echo $this->AssetCompress->css('logged'); (same for ->script())
The output error is:
Error: The requested address '/asset_compress/assets/get/public.css' was not found on this server.
What am I missing?
Ok, I figured it out.
It was because I was using the CssMin filter and I did not download it and put it into the vendor folder. As the plugin seems to be turning the debug level to 0, I did not see the error, until I put a Configure::write('debug', 2); into the beforeFilter().

Resources