#396 ✓resolved

Feature request - Need a php script to extract language phrases

Reported by dleffler | November 12th, 2011 @ 05:26 PM | in 2.0.3 (closed)

Need an external script to traverse the directory structure (less /external, etc...) and extract all the language phrases in templates and code files to prevent having to visit each & every page to build the language file. Since this will ALLWAYS take longer than 30 seconds, it shouldn't be a site link which will time out and break the page.

May also want to do the same for the auto-translation feature which times out.

As a note: To locate existing language phrases in our files the regex phrase are:

  • To find the |gettext smarty modifier: (?<=["'])[^"']*(?=["']\|gettext)

  • To find the gettext smarty function: (?<=gettext str=['"])\s([^}])(?=['"]})

  • To find the gt() function in php files: (?<=gt(['"]).*(?=['"]))

Comments and changes to this ticket

  • dleffler

    dleffler November 13th, 2011 @ 03:04 AM

    • Assigned user set to “dleffler”

    Updated note (to self, I'd hate to have to re-learn this):

    PHP strings to use with preg_match_all, which also accounts for escaped quotes inside a string:

    • $regex_gettext_mod='/(?<=["'])((\\.|[^'"])*)(?=["']\|gettext)/';
    • $regex_gettext_func='/(?<=gettext str=['"])((\\.|[^'"]))([^}])(?=['"]})/';
    • $regex_gt='/(?<=gt(['"])((\\.|[^'"])*)(?=['"]))/';
  • dleffler

    dleffler November 15th, 2011 @ 02:53 AM

    • State changed from “new” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Bug Tracker for Exponent CMS

Shared Ticket Bins

People watching this ticket