Using i18n in SilverStripe template - silverstripe

I'm using SilverStripe 3.7.1 and PHP 7.2. To translate string in my template I use syntax
<%t Namespace.Entity "String_to_translate" %>
When length of the "String_to_translate" is more than 2045 symbols I get error:
[26-Jul-2018 10:18:33] Error at framework/view/SSTemplateParser.php line 4028: Uncaught SSTemplateParseException: Parse error in template on line 163. Error was: Malformed opening block tag t. Perhaps you have tried to use operators?
Can I change the maximum length of the string to translate?

Related

Wordpress-ob_start():failed to create buffer

My website was built with wordpress and now I get the following error:
PHP message: PHP Warning: ob_start(): function '‘ob_gzhandler’' not
found or invalid function name in /var/www/html/wordpress/index.php on
line 15
And this is index.php:
enter image description here
Any idea to fix it?
Try setting the Content-Encoding header.
header('Content-Encoding: gzip');

Closure Compiler: JSC_PARSE_ERROR: Parse error

Does anyone know how to fix the following error when trying to use Google's Closure Compiler:
JSC_PARSE_ERROR: Parse error. primary expression expected at line 1 character 1 in www.myWebsite.co.uk
<!DOCTYPE HTML>
^
If i just specify javascript files i get the following error (errors appear for each file when i do one at a time):
JSC_PARSE_ERROR: Parse error. primary expression expected at line 17 character 72
http://www.myWebsite.co.uk/javascripts/tinynav.min.js
That files code is as follows:
/*! http://tinynav.viljamis.com v1.1 by #viljamis */
(function(a,i,g){a.fn.tinyNav=function(j){var b=a.extend({active:"selected",header:"",label:""},j);return this.each(function(){g++;var h=a(this),d="tinynav"+g,f=".l_"+d,e=a("<select/>").attr("id",d).addClass("tinynav "+d);if(h.is("ul,ol")){""!==b.header&&e.append(a("<option/>").text(b.header));var c="";h.addClass("l_"+d).find("a").each(function(){c+='<option value="'+a(this).attr("href")+'">';var b;for(b=0;b<a(this).parents("ul, ol").length-1;b++)c+="- ";c+=a(this).text()+"</option>"});e.append(c);
b.header||e.find(":eq("+a(f+" li").index(a(f+" li."+b.active))+")").attr("selected",!0);e.change(function(){i.location.href=a(this).val()});a(f).after(e);b.label&&e.before(a("<label/>").attr("for",d).addClass("tinynav_label "+d+"_label").append(b.label))}})}})(jQuery,this,0);
I don't understand where the error is?
The closure compiler compiles closure-annontated JavaScript ; not random JavaScript.
As in the comments, CC is seeing a webpage. That webpage is the Git page, not the actual extern URL required in the CC header.
To Fix:
When at Github looking for your extern file:
https://github.com/google/closure-compiler/blob/master/contrib/externs/jquery-1.12_and_2.2.js
Click the button called Raw to see the actual file URL: https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jquery-1.12_and_2.2.js
Then copy it in to your CC header
// #externs_url https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jquery-1.12_and_2.2.js

Michael Hartl's Railstutorial : Listing 7.32: A template for tests of the error messages

The example code:
assert_select 'div#<CSS id for error explanation>'
assert_select 'div.<CSS class for field with error>'
This generates:
DEPRECATION WARNING: The assertion was not run because of an invalid css selector. ] 16% Time: 00:00:01, ETA: 00:00:06
unexpected '#' after '[#]' (called from block in at /home/ubuntu/workspace/sample_app/test/integration/users_signup_test.rb:25)
DEPRECATION WARNING: The assertion was not run because of an invalid css selector.
unexpected '<' after '.' (called from block in at /home/ubuntu/workspace/sample_app/test/integration/users_signup_test.rb:26)
I read somewhere that versions 4.2+ need an other way to do assert_select. Is that true? And what should be used?
[ I have to say; I am still an absolute beginner ]
substitute a your-class under <CSS class...>, and your-id under <CSS id ...>

Unexpected token ILLEGAL in concatenated CSS file

I'm getting the following error in the Chrome console:
Uncaught SyntaxError: Unexpected token ILLEGAL
At the start of my concatenated CSS file:
#import url("http://fonts.googleapis.com/css?family=Raleway:300,400,600")
This line ends up on its own, and it's specifically this line that throws the error:
I've had a look around and it seems this error should relate to invisible characters making their way into the code. Unfortunately in my case that doesn't seem to be true. I've even deleted this portion of code and re-written it by hand to make sure - no difference.
I use Stylus (with gulp) and the resulting compile is naturally what throws the error - is this maybe an issue with gulp-stylus? I've looked at the compiled code and can't track down any invisible characters there either…
Does anything else throw this error?
The error implies you are trying to load the style sheet with <script> instead of <link rel=stylesheet>.
CSS is not JavaScript and can't be treated as such.

Errors when loading ci-merchant library

I'm trying to use http://ci-merchant.org/ for CodeIgniter. But when I load the merchant library, I get these errors:
A PHP Error was encountered
Severity: Warning
Message: stripos() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 97
A PHP Error was encountered
Severity: Warning
Message: strtolower() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 103
Here is my code:
$this->load->library('merchant');
$this->merchant->load('paypal_express');
Looking at the source of that file, the driver name needs to be passed as a string. So I highly doubt the two lines of code you put above is actually what's being called, it looks like you are passing an array as the driver name.
If you aren't sure where it's coming from, try adding some debug_print_backtrace() lines to the merchant.php file to figure out where the array is getting passed from.

Resources