b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Advanced Topics
  3. Translations (i18n/l10n)
  4. Internationalization (i18n) Guidelines

Internationalization (i18n) Guidelines

General Rule

All strings in PHP that need to be translated to a different language should be included in the T_() function like this:

T_(’Hello!’)

When using b2evolution in English, this will return Hello!. When using b2evolution in French for example, this will return Bonjour! – provided, of course, that the string has been translated in the French language pack.

Javascript

Because JavaScript has different special character escaping requirements than PHP, all strings that are used in JavaScript should use TS_() instead of T_(), like this:

TS_(’Hello!’)

Deferred translation

Sometimes you need to assign a string to a variable but you don’t want to translate it right away. This is especially important if the user language is not known at the time you set the variable. In this time you want the string to be extracted from the source so translators wan translate it but you don’t want PHP to translate it right away. You can do this like this:

$var = NT_(’Hello!’)

When you later need to translate the string, you do:

T_( $var )

DO NOT TRANSLATE DEBUG MESSAGES!

As a developer, there are many times when you should NOT use T_() on your strings. This is the case for:

  • Debug messages, including:
    • all messages that appear in the debug info at the bottom of the page in debug mode
    • the AJAX debug log
  • Log messages, including:
    • all messages that go to a log file
    • reports of scheduled tasks
    • all message sin the system log (i7)

Those messages are too complex for translators to understand them and they will translate them wrong in 99% of the cases.

It’s better to have good English debug messages than incorrect translated ones.

Created by fplanque • Last edit by fplanque on 2020-06-09 00:25 • •

No feedback yet

On this page

  • General Rule
  • Javascript
  • Deferred translation
  • DO NOT TRANSLATE DEBUG MESSAGES!

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
  • Operations Reference
  • Advanced Topics
    • Using Desktop Blogging Tools
    • Using Blogging Apps
    • Blogging by email
    • Using the APIs
    • Contributing
    • Translations (i18n/l10n)
      • How to install a language pack
      • Translating b2evolution
      • Formal vs Casual l10n
      • How to create your own flag / locale
      • Localizing Plugins
      • Localization FAQ
      • Command Line Tools for localization
      • Internationalization (i18n) Guidelines
      • Translation Guidelines
    • Monetizing
    • How to...
    • Podcasting
  • Glossary
  • Archives
Web Site Builder

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque