Jump to content

Search the Community

Showing results for tags 'language translation'.

  • 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. Hello for all. Maybe it's only me, but when I build some website in my native language (one language non-english website) I do not use/install "Language support" modules - do you do the same or it's only my wrong practice? In that case, all my development is "fixed" (eg. can't share some scripts/code with the community, or some custom module etc.), or if I install some "frontend" module from PW repository than, also, have to install and "Language support" modules, or do ugly job (rewrite module static phrases). Right now I found some solution (write it here) but in that case "Language Support" module installed (2 more database table, 1 template, 1 page, indexing, checking, processing etc...), but with hook addition inside "wire/core/LanguageFunctions.php" all that can be avoid. Also in that case all PW standard translation procedures stay the same, but also we get new custom translation options (like in one-language non-english websites I will use that principle, but in multilanguage will use native and fast PW principle). Thanks and regards for all. p.s. if this is a "spam" question (because write almost the same things here) then please administration to delete one of these two topics.
  2. Hello for all. This is not a topic about multilanguage websites, but mostly about one-language web sites and translation methods. In one-language none-english projects I don't install "Language Support" modules, but still use static English phrases in files ("Read more"...), and later translate that phrases using some of many options (eg. method + arrays). To simplifie this topic: if you build website in one none-english language (eg. Germany, Russian etc.) and, as example, want to use wonderfull "Pollino" Soma module, than you have to install "Language Support" module, or you will have "Vote" button at the form. And that's ok. But how to translate that module phrases without using "Language Support" modules? <- was my first idea. Also, all this is in connection with my custom development where I want to standardise some things, like translation of static phrases. Target: Leave, and respect native PW call for all phrases in English (__("Some text")) and use that standard principle in all projects (one language, or multilanguage). Idea: use hooks inside __() call and at the beginning, stop all next calls and procedures, and do some compare and replace job Problem: there is no hookable method for that job ("wire/core/LanguageFunctions.php") Currently working solution (example): // _func.php // prepend // Call Language Support module // You can comment next line if you have installed module // , or this will do the same job $module = wire('modules')->get('LanguageSupport'); // Here we rewrite response from module function translation( HookEvent $event ){ $event->return = translate( $event->arguments(1) ); } // These is the example where we do "find and replace" job // You can use different variant, like include dict. file function translate( $phrase ){ $dictionary = array( 'Read more' => 'Opširnije', 'Total votings:' => 'Ukupno glasova: ', 'Vote' => 'Glasaj', 'Name' => 'Ime i prezime', 'Message'=> 'Poruka', 'Subscribe' => 'Pošalji', 'Missing required value' => 'Ovo polje je obavezno', 'Next' => '>>', 'Prev' => '<<' ); return isset($dictionary[$phrase]) ? $dictionary[$phrase] : $phrase; } // This is the main part where we hook wire()->addHookAfter('LanguageTranslator::getTranslation', null, 'translation'); I didn't avoid "Language Support" installation, but with this I can translate all website phrases in one place (good if you need to translate 20 - 30 views with repeatable phrases, eg. "Read more"). Also with this no need to use custom translation methods (use default PW call (__("Some text")). p.s. also there is idea to hook append same 'textdomain' for all files/views Regards, Sasa
×
×
  • Create New...