silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
721 stars 821 forks source link

[I18N] Length limitation of string-to-translate in i18n #8297

Open asml1951 opened 6 years ago

asml1951 commented 6 years ago

SilverStripe 3.7.1

PHP 7.2.6 (cli) (built: Jun 23 2018 01:23:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.6, Copyright (c) 1999-2018, by Zend Technologies
phpunit/phpunit                          5.7.27 The PHP Unit Testing fram...
silverstripe-australia/silverstripe-news 1.3.0  News module for silverstripe
silverstripe-themes/simple               3.1.1  The SilverStripe simple t...
silverstripe/bootstrap-forms             1.2.0  Allows you to create form...
silverstripe/cms                         3.7.1  The SilverStripe Content ...
silverstripe/forum                       0.8.4  Forum module for SilverSt...
silverstripe/framework                   3.7.1  The SilverStripe framework
silverstripe/reports                     3.7.1  Reports module for Silver...
silverstripe/siteconfig                  3.7.1  Site wide settings admini...
silverstripe/translatable                2.3.2  Allows translation of Dat...

Description

To translate string in my template I use i18n syntax:

<%t Namespace.Entity "String_to_translate" %>

When length of the "String_to_translate" is more than 2045 symbols I get error message:

[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? You can see full error message in attached file: i18n_error.txt

How can I override this lenth limitation?

robbieaverill commented 6 years ago

Needs re-validation against SilverStripe 4.x. We are only accepting bug fixes for critical/security issues in 3.x now, so unless this also affects 4.x it's unlikely to get looked at =(

robbieaverill commented 6 years ago

Hi @asml1951 - how are you getting the error message? Are you running the text collector, viewing a page on the frontend, etc? The stack trace indicates a page request but I'd just like to check.

I can't reproduce this with PHP 5.6 by the way:

<%t MainPage.SubjectText "Subject of foobar activities is the cooperation in the field of classification and certification of inland and river-sea navigation vessels, sea-going ships, technical survey of ships and other industrial, construction and transport objects as well as cooperation in the field of certification of quality systems, manufacture, goods, work and services.</p><p><br></p><p>The main objectives of foobar are:</p><p>improvement of activities aimed at determination of safety operation conditions of inland and river-sea navigation vessels, sea-going ships and other floating structures, protection of human life at sea and on inland waterways, safety of cargoes including dangerous goods, prevention of environmental pollution;</p><p>development and harmonization of requirements for ships and other supervised objects aimed at improvement of the Rules of foobar members;</p><p>improving the technical survey over industrial, construction and transport objects;</p><p>improving the quality of rendered services in the field of classification, technical surveys, certification and maintenance of internal quality management system.</p><p><br></p><p>The objectives shall be achieved by means of:</p><p>information exchange on foobar members’ organization of work;</p><p>exchange of current Rules, Regulations and other normative documents applied in the activities of foobar members;</p><p>joint solving of technical problems related to development and updating of the Rules and other normative documents applied in the activities of foobar members;</p><p>harmonization of technical policy in matters of foobar members’ general interest;</p><p>harmonization of views in matters related to international requirements for vessels and other supervised objects;</p><p>development of training and advanced training system for technical staff;</p><p>development of the quality management system common for all foobar members;</p><p>implementation of the quality management system requirements by all foobar members.</p><p>In accordance with the subject and objectives of its activities foobar within scope of its competence supports the activities of the United Nations Organization and promotes propagating the information on its objectives and principles. foobar supports the objectives of the International Maritime Organization (ABC) and promotes the implementation of ABC International Conventions and Resolutions.</p></blockquote></div>" %>

It might be the sheer volume of large translations in your page template (I haven't tried the whole thing).

asml1951 commented 6 years ago

Hi Robbie! I use PHP 7.2.6 and my SS site is in dev mode, so I get error message in browser. Fig1.png shows normal display of element

<%t MainPage.SubjectText 'Subject of TSCI activities is the cooperation in the field of classification and certification of inland and river-sea navigation vessels, sea-going ships, technical survey of ships and other industrial, construction and transport objects as well as cooperation in the field of certification of quality systems, manufacture, goods, work and services.</p><p><br></p><p>The main objectives of TSCI are:</p><p>improvement of activities aimed at determination of safety operation conditions of inland and river-sea navigation vessels, sea-going ships and other floating structures, protection of human life at sea and on inland waterways, safety of cargoes including dangerous goods, prevention of environmental pollution;</p><p>development and harmonization of requirements for ships and other supervised objects aimed at improvement of the Rules of TSCI members;</p><p>improving the technical survey over industrial, construction and transport objects;</p><p>improving the quality of rendered services in the field of classification, technical surveys, certification and maintenance of internal quality management system.</p><p><br></p><p>The objectives shall be achieved by means of:</p><p>information exchange on TSCI members’ organization of work;</p><p>exchange of current Rules, Regulations and other normative documents applied in the activities of TSCI members;</p><p>joint solving of technical problems related to development and updating of the Rules and other normative documents applied in the activities of TSCI members;</p><p>harmonization of technical policy in matters of TSCI members’ general interest;</p><p>harmonization of views in matters related to international requirements for vessels and other supervised objects;</p><p>development of training and advanced training system for technical staff;</p><p>development of the quality management system common for all TSCI members;</p><p>implementation of the quality management system requirements by all TSCI members.12345678901234567890123456789012345678901234567890123456789' %> fig1

And Fig2.png shows error message when I add one character to the end of MainPage.SubjectText element:

<%t MainPage.SubjectText 'Subject of TSCI activities is the cooperation in the field of classification and certification of inland and river-sea navigation vessels, sea-going ships, technical survey of ships and other industrial, construction and transport objects as well as cooperation in the field of certification of quality systems, manufacture, goods, work and services.</p><p><br></p><p>The main objectives of TSCI are:</p><p>improvement of activities aimed at determination of safety operation conditions of inland and river-sea navigation vessels, sea-going ships and other floating structures, protection of human life at sea and on inland waterways, safety of cargoes including dangerous goods, prevention of environmental pollution;</p><p>development and harmonization of requirements for ships and other supervised objects aimed at improvement of the Rules of TSCI members;</p><p>improving the technical survey over industrial, construction and transport objects;</p><p>improving the quality of rendered services in the field of classification, technical surveys, certification and maintenance of internal quality management system.</p><p><br></p><p>The objectives shall be achieved by means of:</p><p>information exchange on TSCI members’ organization of work;</p><p>exchange of current Rules, Regulations and other normative documents applied in the activities of TSCI members;</p><p>joint solving of technical problems related to development and updating of the Rules and other normative documents applied in the activities of TSCI members;</p><p>harmonization of technical policy in matters of TSCI members’ general interest;</p><p>harmonization of views in matters related to international requirements for vessels and other supervised objects;</p><p>development of training and advanced training system for technical staff;</p><p>development of the quality management system common for all TSCI members;</p><p>implementation of the quality management system requirements by all TSCI members.123456789012345678901234567890123456789012345678901234567890' %>

fig2

Full text of error message is here

error_message.txt

robbieaverill commented 6 years ago

Ok thanks, that should be enough info to reproduce the issue

robbieaverill commented 6 years ago

Yes I can reproduce this now. SilverStripe 3 is in limited support now (security and critical bugfixes only), so we'll need to check if this affects v4 (it probably will)

maxime-rainville commented 6 years ago

Just confirmed on SS4.3.