Jump to content

Search the Community

Showing results for tags 'internationalization'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. Hey community, first of all: I love this CMS! But unfortunately my Code Internationalization (i18n) doesn´t work within included php files: I´m using the module Pro Fields Page Table, the regular Languages Support Module and no template caching. The website has 2 Languages (DE as default, EN as second language) Problem: Using <?php echo(__('Test')); ?> within /site/templates/home.php works without any problems and gets translated correctly However using <?php echo($this->_('Headline'));?> within /site/templates/components/component.php does not work. Note: using <?php echo(__('Headline'));?> in .../component.php throws an error and therefore cannot be used. Example: /site/templates/ce-includer.php (Template with the dynamic text-field 'filepath'): include('components/'.$page->filepath); this correclty includes the file "/site/templates/components/home-content.php" Code in home-content.php: <h1><?php echo($this->_('Headline'));?></h1> Output for both pages (DE and EN version - the string was translated to "Headline DE" in german and "Headline EN" in english): <h1>Headline</h1> Does anyone know how to use Code Internationalization in such a szenario? All the best and keep up the great work! Daniel
  2. https://processwire.com/api/multi-language-support/code-i18n/ In the documentation about Code Internationalization the following is mentioned: Translatable strings In order to make a string translatable in your template or module code, you just have to wrap the original string in a $this->_() or __() function call: $out = $this->_("Live long and prosper"); // syntax within a class $out = __("Live long and prosper!"); // syntax outside of a class Inside my methods the first example of syntax in a class seems to work fine. Somehow the following code seems to throw a 500 Internal Server Error which states: Parse Error: syntax error, unexpected '$this' (T_VARIABLE) Example: class SomeModuleName extends WireData implements Module, ConfigurableModule { /** * Returns gender type * * @static * @return string */ private static $gender = array( 1 => $this->_("Male"), 2 => $this->_("Female"), ); } I can image since the module is not initialized or constructed yet that $this is not available at that spot. Any tips on how to be able to make those values multilanguage?
×
×
  • Create New...