Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4023430
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:35:51+00:00 2026-05-20T10:35:51+00:00

i have already succesfully translated some quotes via my translation function __(); and now

  • 0

i have already succesfully translated some quotes via my translation function __(); and now I want to echo only one of those quotes at random. All quotes are separated in this string with a special character like a |

Sofar I only have this. What code could should go below this tackle my random echo?

$quotes =
__("IF YOU MAKE EVERYTHING BOLD, NOTHING IS BOLD") . "|" .
__("Quality of design is an indicator of credibility") . "|" .
__("People ignore design, that ignores people");

(An important restriction: it is essential that the quotes be exactly closed with __(" and "); sothat they can be checked and translated.) __($variable) doest not work with current clean up scripts that I have bought so these won’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:35:52+00:00Added an answer on May 20, 2026 at 10:35 am

    You’re already calling __() on each of your quotes individually, why not save all the extra translating and do something like:

    $quotes = array('quote1', 'quote2', 'quote3');
    $index = array_rand($quotes);
    echo __($quotes[$index]);
    

    Edit: To satisfy your other requirement, that the call to __() must immediately surround each string, you could do this:

    $quotes = array(__('quote1'), __('quote2'), __('quote3'));
    $index = array_rand($quotes);
    echo $quotes[$index];
    

    The big downside here is that you’re now looking up a translation for every string in that array, even though only one is printed, but that’s the same situation you had in the “one big string” solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have already search for some time over the net on how to create
I have already implemented some AJAX pagination in my Rails app by using the
I have already get how to insert in the database. My only problem is
I already have succesfully used MVVM principles in former projects, but i'm stuck with
Intro: I have written some short excel macros (tested, they work fine) and want
I've installed Django-registration succesfully (form this tutorial) . So now I have a Django
In .NET I have already tried the configuration below successfully: <system.net> <connectionManagement> <add address=*
I have already searched about this issue, analyzed several open source tools (like Ganymed
I have already posted something similar here but I would like to ask the
I have already tried PreRenderComplete and unload is too late

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.