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 862959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:13:47+00:00 2026-05-15T09:13:47+00:00

Digging into the api looking for methods to translate a property of a category

  • 0

Digging into the api looking for methods to translate a property of a category term I could only find methods that take a string as the param, but what happens when I have the id of the object which property I want to translate? I’d like to be able to just pass this id and get the translated string (if exists). I achieved this with a relatively simple query:

   function translate_term_description($tid) {
    $result = db_query('SELECT term_data.tid, term_data.description, locales_target.translation 
                        FROM {term_data} 
                        left join ({i18n_strings}, {locales_target}) 
                        on (term_data.tid = i18n_strings.objectid and i18n_strings.lid = locales_target.lid) 
                        where term_data.tid = %d', $tid);

    $term_data = db_fetch_object($result);

    // If a translated string is available return that, otherwise return back the untranslated description
    return !is_null($term_data->translation) ? $term_data->translation : $term_data->description;
}

I just needed the description and I’m just using this function in a context where’s it’s assumed that the target language is the non-default. Still, it can be expanded to take both the target language and the term property as params.

So what do you think? Should something like this exist on Drupal, or does it have it already (if so, please point me where) ?

  • 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-15T09:13:47+00:00Added an answer on May 15, 2026 at 9:13 am

    What about i18ntaxonomy_translate_terms from Internationalization ?

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

Sidebar

Related Questions

I am digging into LINQ--trying to understand basic models (it seems pretty cool to
I'm digging into Reflection for the first time and I'm truely stuck. I've googled
I recently started digging into design patterns. Generally speaking, I thought the design issues
I've seen once on a site, a call graph digging into the most low
I've been digging through some parts of the Linux kernel, and found calls like
I've been digging through Stack Overflow as well as a number of Google searches,

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.