How to translate overriden module in PrestaShop 1.7 new translation system? - translation

I wanted to add some new translatable strings in override of module ps_facetedsearch which is located in override/modules/ps_facetedsearch so in one of PHP files I have this code"
$sortDateDesc->setLabel($translator->trans('Newest', [], 'Modules.Facetedsearch.Shop'));
But this string does not appear on translation page ( International > Translations > Installed modules translations).
It seems like translation system is not scanning override folder ...
How do I add new translations to module code override (not template)?

Related

excel xlwings_udfs module is empty

Using xlwings 0.7.1 UDF on Windows in 64-bit virtual env python 2.7.6.
I see now that instead of requiring full path to module, it takes module names. However it fails silently to import any UDFs when the module name has package name prefixed. Eg:
PYTHONPATH = ThisWorkbook.Path & ";C:\pathTo\Pydev\myproj\src"
UDF_MODULES = "pkg.myudfs"
If I move the package name 'pkg' from UDF_MODULES to PYTHONPATH, then it fails at imports inside myudfs.py (like 'import pkg.module2').
After hit & trial, I fixed it by adding multiple source folders:
PYTHONPATH = ThisWorkbook.Path & ";C:\pathTo\Pydev\myproj\src\pkg;C:\pathTo\Pydev\myproj\src"
Am I expected to do this? Can't I just point UDF_MODULES to base src folder and provide qualified module name like 'pgk.myudfs'?
You're actually doing it right for right now (v0.7.1). I have, however, opened an issue on GitHub so we might make this easier in a future release.

eclipse scout neon : Texts in extended project

I have extended project in eclipse scout neon, and I would like to know how to enable texts it this project.
I copy Texts.nls file and create texts folder with Texts.properties inside.
Auto create texts from code doesn't work and give me an error :
The NLS Project is read-only. heck that you have a valid NLS Project in your workspace.
If I add text manually in texts.properties file, it doesn't read from it.
How to fix this?
Have you configured your Texts.nls file correctly? Here an example:
###############################################
# This file is maintained by the NLS editor. #
# To ensure a properly working NLS support #
# keep this file untouched. #
###############################################
Nls-Class=org.eclipse.scout.contacts.shared.TextProviderService
The corresponding TextProviderService java class:
package org.eclipse.scout.contacts.shared;
import org.eclipse.scout.rt.platform.Order;
import org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService;
#Order(2000)
public class TextProviderService extends AbstractDynamicNlsTextProviderService {
#Override
protected String getDynamicNlsBaseName() {
return "org.eclipse.scout.contacts.shared.texts.Texts";
}
}
This is the way how the Scout SDK lookup for your properties files.

syntaxhighlighter -- how to add the optional language pack to standard version

The standard version of syntaxhighlighter 3.0.83 ( http://alexgorbatchev.com/SyntaxHighlighter/download/ ) is similar to the plugin for Wordpress which contains an optional language pack ( http://wordpress.org/plugins/wp-syntaxhighlighter/ ) -- e.g., Biferno, Clojure, DOS batch file, F#, LISP, Lua (only for SyntaxHighlighter 3.0), MEL Script, Objective-C, PowerCLI, Processing, R, S, S-PLUS, Tcl, Verilog, Vim Script and YAML. I'm looking for a way to add the optional languages to the standard version -- any assistance in that regard would be appreciated.
Download the Wordpress plugin from:  http://wordpress.org/plugins/wp-syntaxhighlighter/  As of the date of this answer, the most recent version was wp-syntaxhighlighter.1.7.3.zip
Extract the *.js and *.css files from the subfolders within the folder lang-pack-for-wp-syntaxhighlighter and organize them to your liking. In my case, I chose to place the *.js language files inside the folder syntaxhighlighter/scripts/ in the standard version. There was only one *.css file -- i.e., shBrushProcessing.css and I chose to place that inside the folder syntaxhighlighter/styles/ in the standard version.
In your *.html file, ensure the path to the brush javascript file is correct -- e.g., for lisp use:
<script type="text/javascript" src="syntaxhighlighter/scripts/shBrushLisp.js"></script>
In your *.html file, the brush must correspond to the brush javascript file -- e.g., for lispuse:
  <pre class="brush: lisp">

How do I derive physical path of a relative directory inside Config.groovy?

I am trying to set up Weceem using the source from GitHub. It requires a physical path definition for the uploads directory, and for a directory for appears to be used for writing searchable indexes. The default setting for uploads is:
weceem.upload.dir = 'file:/var/www/weceem.org/uploads/'
I would like to define those using relative paths like WEB-INF/resources/uploads. I tried a methodology I have used previously for accessing directories with relative path like this:
File uploadDirectory = ApplicationHolder.application.parentContext.getResource("WEB-INF/resources/uploads").file
def absoluteUploadDirectory = uploadDirectory.absolutePath
weceem.upload.dir = 'file:'+absoluteUploadDirectory
However, 'parentContext' under ApplicationHolder.application is NULL. Can anyone offer a solution to this that would allow me to use relative paths?
look at your Config.groovy you should have (maybe it is commented)
// locations to search for config files that get merged into the main config
// config files can either be Java properties files or ConfigSlurper scripts
// "classpath:${appName}-config.properties", "classpath:${appName}-config.groovy",
grails.config.locations = [
"file:${userHome}/.grails/${appName}-config.properties",
"file:${userHome}/.grails/${appName}-config.groovy"
]
Create Conig file in deployment server
"${userHome}/.grails/${appName}-config.properties"
And define your prop (even not relative path) in that config file.
To add to Aram Arabyan's response, which is correct, but lacks an explanation:
Grails apps don't have a "local" directory, like a PHP app would have. They should be (for production) deployed in a servlet container. The location of that content is should not be considered writable, as it can get wiped out on the next deployment.
In short: think of your deployed application as a compiled binary.
Instead, choose a specific location somewhere on your server for the uploads to live, preferably outside the web server's path, so they can't be accessed directly. That's why Weceem defaults to a custom folder under /var/www/weceem.org/.
If you configure a path using the externalized configuration technique, you can then have a path specific to the server, and include a different path on your development machine.
In both cases, however, you should use absolute paths, or at least paths relative to known directories.
i.e.
String base = System.properties['base.dir']
println "config: ${base}/web-app/config/HookConfig.grooy"
String str = new File("${base}/web-app/config/HookConfig.groovy").text
return new ConfigSlurper().parse(str)
or
def grailsApplication
private getConfig() {
String str = grailsApplication.parentContext.getResource("config/HookConfig.groovy").file.text
return new ConfigSlurper().parse(str)
}

load_plugin_textdomain not working

Hey i'm trying to localize a plugin called Donate Plus ( which locallized technicly).
the plugin came with en_CA and de_DE files, i've tried creating a he_IL file without success.
So i've tried with the de files came with the plugin but didn't work.
I've set the WPLANG in wp-config.php to de_DE yet that dosen't change the code.
this is the setting code :
load_plugin_textdomain( 'dplus', '/wp-content/plugins/donate-plus' );
And i did check that all the string are set to be localized.
Anyone has a clue?
I just was with a similar isue, did you try to rename your files from de_DE.po and de_DE.mo to name-of-plugin-de_DE.mo and name-of-plugin-de_DE.po (changing name-of-plugin with yours, of course)?
dplus-de_DE.mo and dplus-de_DE.po It must work ;)
load_plugin_textdomain takes three parameters.
In your case it would be something like this (assuming the .po and .mo files are located in a subdir called 'languages')
load_plugin_textdomain( 'dplus', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
I checked the source of DonatePlus Plugin and I found that the Plugin is doing localization wrongly.
The load_plugin_textdomain() call is made inside the DonatePlus classes constructor. But it should be present inside the 'init' hook. Trying adding the following code (which is at the of the file) inside the init function.
if( class_exists('DonatePlus') )
$donateplus = new DonatePlus();
Where are all the .po and .mo files stored? Are they inside the /wp-content/plugins/donate-plus folder itself? If not then change the path or move the files.
I had a similar issue where I was loading the translation files with the load_plugin_textdomain function from within a service class using PSR-4. This meant that the dirname( plugin_basename( __FILE__ ) ) string returned the wrong path.
The correct path is the relative path your-plugin/languages (assuming you are loading the translation files from the /languages directory).
Absolute paths such as /var/www/html/wp-content/plugins/my-plugin/languages won't work.
My plugins file structure looks something like this:
- my-plugin
- assets
- languages
- services
- Api
- Base
Translation.php
- ...
Plugin.php
- vendor
- views
composer.json
composer.lock
index.php
my-plugin.php
uninstall.php
Since my Translation service is placed in the /services/Base/ directory, this worked for me:
$root = plugin_basename(dirname(__FILE__, 3));
load_plugin_textdomain( 'my-plugin', false, "$root/languages/");
Also, I used no action hook at all instead of init or plugins_loaded and fired the load_plugin_textdomain function at the beginning of the plugin, since the hooks don't fire early enough for the admin menu and action links to get translated.
Use:
load_textdomain( TEXT_DOMAIN , WP_PLUGIN_DIR .'/'.dirname( plugin_basename( FILE ) ) . '/languages/'. get_locale() .'.mo' );

Resources