Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
wants to merge 6 commits into from
Closed

Added CsvFileLoader to support csv translation resources. #46

wants to merge 6 commits into from

Conversation

umpirsky
Copy link
Contributor

@umpirsky umpirsky commented Jan 8, 2011

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ć.

@fabpot
Copy link
Member

fabpot commented Jan 8, 2011

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.

@umpirsky
Copy link
Contributor Author

umpirsky commented Jan 8, 2011

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 ;)

@fabpot
Copy link
Member

fabpot commented Jan 8, 2011

I'm not really familiar with gettext, but can't we just use the native PHP support?

@umpirsky
Copy link
Contributor Author

umpirsky commented Jan 8, 2011

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.

@CraigMason
Copy link

Just started using this today - thanks. I note that you have hard coded semicolon as being the delimiter. Could this be customised?

@umpirsky
Copy link
Contributor Author

@LoaderInterface Well, if you tend to instantiate loader yourself, yes. But why would you do that?

@CraigMason
Copy link

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(';');

dawehner pushed a commit to dawehner/symfony that referenced this pull request Jul 1, 2013
remove RouteObjectInterface::CONTROLLER_ALIAS
jderusse pushed a commit to jderusse/symfony that referenced this pull request Mar 30, 2020
chalasr pushed a commit to chalasr/symfony that referenced this pull request Sep 24, 2020
This pull request was closed.
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.

3 participants