Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate multilingual route extraction and translation #1794

Merged
merged 3 commits into from
Jun 21, 2014
Merged

Activate multilingual route extraction and translation #1794

merged 3 commits into from
Jun 21, 2014

Conversation

cmfcmf
Copy link
Contributor

@cmfcmf cmfcmf commented Jun 20, 2014

Q A
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? ---
Fixed tickets ---
Refs tickets #1793, schmittjoh/JMSTranslationBundle#201
License MIT
Doc PR ---
  • Globally ignore @type annotation. Necessary to be able to use the extended array documentation syntax (which is used in the Core):

    /**
     * Related to getRegistrationErrors, returns error information related to a new or modified e-mail address.
     *
     * @param mixed[] $args {
     *      @type int    $uid        The uid of the user to be checked; optional.
     *      @type string $email      The e-mail address to be checked.
     *      @type string $emailagain The repeated e-mail address entered by the user for verification.
     *                      }
     *
     * @return array An array of error information organized by registration form field.
     */
  • Moved Doctrine service alias from Zikula Event (core preinit) to CompilerPass. This is necessary to have the alias available even if the Zikula Core is not booted (e.g. if a Symfony console command is used).

  • Made the multilingual routing working. I needed to introduce two global variables in the process, to be able to filter the routes by module.

To translate routes, make sure the module is correctly installed, then run:

php app/console translation:extract LOCALE --bundle=BUNDLENAME  --enable-extractor=jms_i18n_routing --output-format=po

e.g.

php app/console translation:extract de --bundle=ZikulaUsersModule  --enable-extractor=jms_i18n_routing --output-format=po

This creates a translations folder in the bundle's Resources folder with a .po file in it. Translate it as usual.

Note:
You can also use other formats, however xliff is the suggested one.

[0] => php
[1] => xlf
[2] => po
[3] => mo
[4] => yml
[5] => ts
[6] => csv
[7] => ini
[8] => json
[9] => res
[10] => xliff

Note 2:
If you receive PHP notices / warnings while running the command, it might probably be this bug and can be ignored.

@@ -138,7 +149,7 @@ public static function loadPersistentServices()
}

foreach ($handlers as $id => $handler) {
self::$serviceManager->registerService(new Zikula_ServiceManager_Service($id, $handler['definition'], $handler['shared']));
self::$serviceManager->registerService($id, $handler['definition'], $handler['shared']);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a wrong method call, as Zikula_ServiceManager::registerService looks like so:

 public function registerService($id, Zikula_ServiceManager_Definition $definition, $shared = true)

@cmfcmf cmfcmf mentioned this pull request Jun 20, 2014
2 tasks
@cmfcmf cmfcmf added this to the 1.4.0 milestone Jun 20, 2014
Guite added a commit that referenced this pull request Jun 21, 2014
Activate multilingual route extraction and translation
@Guite Guite merged commit 6ebacde into zikula:1.4 Jun 21, 2014
@cmfcmf cmfcmf deleted the multilingual-extraction branch June 21, 2014 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants