Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Simple Eloquent Model Translations
Jan 16, 2018 @ 09:41:46

On the Pineco.de blog there's a new post for the Laravel users out there showing you a simple way to integrate translations handling into your models. This functionality allows you to more easily build multilingual applications without having some of the overhead of a separate translation framework.

Making you models translatable could be an issue, especially if you are running an application that is multilingual. For static texts, we can use the built-in translation engine, but for models, we need to solve a more complex issue. Let’s take a look at a simple yet flexible solution.

While the post starts with a recommendation to use a full package if you need a more robust system, it quickly moves into the simpler structure they'll be defining. The tutorial describes the "translation mechanism" from a high level and includes the code to create the database table for holding the translated content. With that in place, next up is the model to connect the application with the table and a trait to house the translation logic. This is then used directly in the template (as a translation property) to fetch the translated version of the content.

tagged: eloquent model translation tutorial trait relation i18n

Link: https://pineco.de/simple-eloquent-model-translations/

Jeff Madsen:
Using Laravel Translation Strings in Vue.js
Dec 28, 2017 @ 09:51:02

Jeff Madsen has a new post to his site showing you how integrate Laravel's translations strings with a Vue.js frontend making it simpler to maintain only one source for the translation of content in your application.

One issue you will face if you need to make a multi-lingual site is how to keep your translations organized for both your back-end framework and your javascript components. I’m going to demonstrate the basic technique for this, using Laravel and Vue.js for my example.

While his examples make use of Laravel and Vue.js, the approach is agnostic of most tools and could be modified to integrate with other technologies pretty easily. He builds a system where the translations are kept in PHP files which are converted into something Vue can read and use. He starts with the backend, showing how to use Laravel's localization functionality to set up the files and shift between languages. He then makes use of the lang.js library to pull the contents of these files into Vue and adds in a bit of code to push those values into components.

tagged: vuejs language translation tutorial string laravel

Link: https://medium.com/@codebyjeff/using-laravel-translation-strings-in-vue-js-e2e35b7aafca

JoliCode Blog:
How to properly manage translations in Symfony?
Dec 14, 2017 @ 10:13:31

The JoliCode site has posted a tutorial for the Symfony users out there sharing their method for properly managing translations when using the framework.

We already wrote about our Symfony translation workflow some years ago. But since 2015, lots of things have evolved and it was time to update this workflow.

The aim stays the same, keeping app translation simple and fluent for all stakeholders of the project. To achieve this, we had chosen an external tool: Loco, which centralizes translation data, and a piece of code written to synchronize it with Symfony translation files.

The article talks about the two main methods (bundles) used in the Symfony ecosystem to manage translations but they couldn't connect them with their chosen tool (Loco). The tutorial then shows how they moved to using the php-translation bundle and how to use the Loco UI to manage the keys connected to it. It also covers the use in testing, migrating to production and what's currently missing from Loco they'd like to see.

tagged: manage translation symfony framework tutorial loco bundle

Link: https://jolicode.com/blog/how-to-properly-manage-translations-in-symfony

Symfony Blog:
Discontinuing the Symfony Community Translations
Oct 01, 2015 @ 10:49:21

In an effort to reduce some of the complexity and possible differences in the translated versions of its documentation, the Symfony project is removing those from the main website and splitting them into their own sections.

A few days ago, we updated the documentation section on symfony.com to remove the French and Italian community translations. From now on, on this website you will only find the original English documentation.

The main reason behind this decision is that when developers browse the documentation published on symfony.com, they must be sure that the contents are always the right ones. In the case of a translation, this means that all its contents in all branches must always be perfectly synced with the original English version.

The English version sees quite a bit of activity and the translated versions (with a lower contributor count) aren't always in sync. They've split out two of the translations and will now have them coordinated each by their own community leader: French and Italian

tagged: symfony community translation french italian english manager

Link: http://symfony.com/blog/discontinuing-the-symfony-community-translations

ServerGrove Blog:
Symfony2 components overview: Translation
Mar 18, 2014 @ 16:37:40

The ServerGrove blog has posted their latest up-close look at the various components that make up the Symfony2 framework. In their latest post, they focus in on the Translator component.

Modern applications need to be internationalized and localized to be able to reach people from all over the world. Internationalization – aka i18n – is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. Localization – aka l10n – is the process of adapting internationalized software for a specific region or language by adding locale-specific components such as dates or currency. The Translation component provides different tools to get your application internationalized, but not localized.

The post covers the three main parts of the component - Catalogues, Loaders and Dumpers - and includes a simple example of creating the object, adding resources and calling "trans" to translate. There's also an example of using the YAML file loader to include the translated strings. There's also mentions of pluralization, translation "domains" and custom loaders.

tagged: symfony2 component overview translation tutorial

Link: http://blog.servergrove.com/2014/03/18/symfony2-components-overview-translation/

Symfony Blog:
Symfony Website Updates
Oct 04, 2013 @ 09:05:44

On the Symfony project's blog today there's a new post from Fabien Potencier talking about some updates that have been made to the Symfony website.

There's a few things that got an update including:

  • Translations that were added to the main site
  • A method of aggregation for Symfony-related blogs
  • A Roadmap notification system that lets you set up email notifications on major roadmap changes and releases.

They're still working on the translations, but if you'd like to help you can contribute to their github repository.

tagged: symfony website update translation planet feed roadmap notification

Link: http://symfony.com/blog/symfony-website-updates

Symfony Blog:
The symfony.com website... in your language
Jun 11, 2013 @ 09:23:43

On the Symfony blog there's a new post mentioning the availability of the static contents of the Symfony site as a public repository.

The Symfony website has always been in English as English is probably the lingua-franca for web developers. But as some sections of the website do not change that frequently (mainly the "What is Symfony?", "Get started", and "About" sections), and because not all developers are comfortable reading English websites, I'm very happy to announce that most of the static contents are now available in a public Git repository.

They've already had people contributing back to the documentation in their own languages including German, Slovak, Czech, Swedish and Polish. Some of them are still works in progress, but they're getting there.

tagged: symfonycom website language translation github repository

Link: http://symfony.com/blog/the-symfony-com-website-in-your-language

Use Poedit to Extract Translations from Twig Templates
Sep 04, 2012 @ 11:34:51

In this new post to the Umpirsky.com development blog, they show you how to use poedit to extract translations from Twig templates.

By default, Poedit does not have the ability to parse Twig templates. In Twig documenation there is a simple example which shows how to extract translations. This can work with few modifications, but I wanted to make reusable tool which will allow you to parse Twig templates just like you do with plain PHP templates.

The result is the Twig-Gettext-Extractor that's set up inside Poedit as a parser command for "*.twig" files. This automatically extracts the information so that the editor can read the data from the template.

tagged: twig template poedit translation gettext extract


Liip Blog:
Symfony documentation in French is online!
Aug 29, 2012 @ 11:05:40

On the Liip blog Thomas Botton points out that the French translation of the Symfony documentation is no online and available for public consumption! He was a part of the group that worked on the translation.

A year ago, I started to work with the Symfony documentation French translation team. At this time, I was actually not imagining that it would take so long to get all that work done.. In case you don't know, as of today, the Symfony documentation team already wrote more than 300 documents! Counting 1 to 4 hours to translate one doc plus the time to review it, you get an idea of the overall workload! But anyway, it's done: the Symfony documentation French translation is finally live on symfony.com!!!

He also mentions some of his reasoning for being a part of the team including it being a way to get more involved with Symfony (and open source) in general and the benefit it now provides to French-speakers wanting to get into the framework. You can find the documentation here.

tagged: symfony framework french translation documentation


ServerGrove Blog:
Easily manage multilingual sites with the new TranslationEditorBundle for Symfony2
Jan 11, 2012 @ 12:09:36

On the ServerGrove blog today there's a new post about using their TranslationEditorBundle (Symfony2) to handle multilingual support for your site.

We have been working a lot with Symfony2 translations lately (we translated our website to Spanish and we are in the process of translating our control panel too). Dealing with multiple translation files is not difficult, but it takes time, lots of copy & paste. We have found that is quite easy to make mistakes, create duplicate lines, etc... in short, it’s messy. To tame the translation chaos we decided to create a simple web based editor to deal with Symfony2 translations. The result is the TranslationEditorBundle and it’s publicly available for anyone to use and contribute to.

The bundle gives you a simple web frontend to the translation process, making it a lot simpler to input the different versions of the text as well as determine where any duplication might be happening. It also gives you things like the total number of entries and the number of them missing their translations.

tagged: translationeditorbundle symfony2 framework translation frontend editor