-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Added CsvFileLoader to support csv translation resources. #46
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
Conversation
This reverts commit fe028c9.
Thanks for that. I've merged the Csv loader. Support for gettext and message extraction is on our todo-list. So, if you want to work on it, that would be wonderful. For message extraction and Twig templates, you can probably read the following paragraph from the Twig documentation to see how this can be done: http://www.twig-project.org/doc/extensions/i18n.html#extracting-template-strings On a side note, you should work on my branch (fabpot/master) instead of this one. My branch is where all the development happens and all pull requests should be done on it. Also, to make my life easier, can you create topic branches for each of your changes? And whenever you want to sync with my repo, force a rebase. Thanks. |
Thanks for accepting the Csv loader. Good trick this forcing twig cache, can be applied to other template engines as well, thanks. Regarding gettext support, we should implement parser for .mo files (http://www.gnu.org/software/hello/manual/gettext/MO-Files.html). I wonder if this parser should be a separated component, and maybe add .po parser later, maybe it can be useful to have this component separated. What do you think? I will look into this problem when I find some time next week. Will fix topic branches and work with fabpot/master ;) |
I'm not really familiar with gettext, but can't we just use the native PHP support? |
Hehum, I think you can just lookup concrete messages with gettext() and ngettext() http://php.net/manual/en/ref.gettext.php. Also, gettext has it's own plural forms. And it is not thread-safe. |
Just started using this today - thanks. I note that you have hard coded semicolon as being the delimiter. Could this be customised? |
@LoaderInterface Well, if you tend to instantiate loader yourself, yes. But why would you do that? |
Actually, ignore my comment. You're diff is using fgetcsv - this was updated to \SplFileObject in the core Symfony repo. I'll go comment there :) try {
$file = new \SplFileObject($resource, 'rb');
} catch(\RuntimeException $e) {
throw new \InvalidArgumentException(sprintf('Error opening file "%s".', $resource));
}
$file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY);
$file->setCsvControl(';'); |
remove RouteObjectInterface::CONTROLLER_ALIAS
ScnSocialAuth XSS Vulnerability
Add SensioLabs Insight
I have implemented CSV translation support.
It would be nice to add gettext as well and provide some automation tools for translation (for e.x. to enable fetching messages from sources with poedit) so translation resources don't need to be generated by hand. Problem with poedit is that it uses keyword, and then parsing strings under keyword() function call.
I am interested to work on this, please provide feedback and your plans for new translation loaders.
Refards,
Saša Stamenković.