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

Reference language selector #60

Merged
merged 18 commits into from Mar 22, 2016
Merged

Reference language selector #60

merged 18 commits into from Mar 22, 2016

Conversation

ghost
Copy link

@ghost ghost commented Jan 30, 2013

A couple of months ago, we added a reference language selector in django-rosetta and it's been sitting in our private fork of it since then. We thought you might like it, so we've cleaned it up and pushed it here.

The feature adds a Reference language selector to the translation interface. This way, instead of having only the option to show the msgid to translate, you can also have the translated version (if you already have other translations) of the msgid. That's useful if you have translators that don't speak your base language.

Virgil Dupras added 8 commits January 29, 2013 15:35
I extracted the minimal feature set I could so that integration with newer
upstream commits are easier.
That's (I think), the last commit for v0.6.7 (versionning in this
project is hazy).
There was a conflict with rosetta/views.py, but it was easily resolved.
The url name was unquoted.
Also, made the default ref lang 'msgid' instead of 'fr'.
This way, it's possible to disable the feature. Also, added a description of
the feature in the README.
@mbi
Copy link
Owner

mbi commented Jan 30, 2013

Thanks Virgil, this looks awesome. Unfortunately I've been getting nasty IOErrors (thrown by polib.py:1313) whenever I try to select a ref language, probably because my test PO files are rubbish. I think ideally we should check whether the reference file is valid (i.e. if it passes loading into polib) before the option is displayed in the select box.

What do you think?

@ghost
Copy link
Author

ghost commented Jan 30, 2013

Yeah, sure. I'd have to try to reproduce the error first. Do you know specifically what kind of rubbish is causing this error?

EDIT: ...or I guess whatever make a PO file invalid. yeah, I can figure that out myself.

@mbi
Copy link
Owner

mbi commented Jan 30, 2013

Well, for starters I had this with a completely missing PO file: in my testproject (in the repo) I have Japanese defined in my settings's LANGUAGES, but there is no PO file for Japanese (to test some edge cases) and selecting it from the list triggered the problem.

@ghost
Copy link
Author

ghost commented Jan 30, 2013

Ah, yeah, languages that don't exist. That makes more sense. I was testing garbage in PO files, but that triggers many errors in django-rosetta that are out of the scope of this pull request.

In fact, the ref selector should use the list_languages() function instead of the LANGUAGES settings. This way, buggy languages won't show up.

@ghost
Copy link
Author

ghost commented Jan 30, 2013

(oh, I meant extract the language filtering logic in list_languages)

@ghost
Copy link
Author

ghost commented Jan 30, 2013

Filtering the languages turned out to be a bit more complicated than I expected. I just fixed the crash. Do you think it's acceptable to display them, but just silently revert to MSGID when the PO can't be loaded?

Wrong/missing POs is a rather rare occurrence in production system anyway...

Virgil Dupras added 2 commits March 5, 2013 08:48
Since render_to_response() in the home() view no longer passes the local scope
as context, we have to explicitly set ENABLE_REFLANG in the template context.
@ghost
Copy link
Author

ghost commented Mar 5, 2013

I've updated my pull request to the latest developments from the develop branch. Just to be sure: Is there anything I haven't done that holds this pull request from being merged?

@mbi
Copy link
Owner

mbi commented Mar 5, 2013

Thanks, I'll review your updated PR, write some unit tests and eventually merge it.

Virgil Dupras added 3 commits April 19, 2013 09:09
Conflicts:
	README.rst
	rosetta/views.py
This crash was introduced by the merge with mbi/develop.
@ghost
Copy link
Author

ghost commented Apr 19, 2013

I've merged again with the develop branch and this time I even threw in a testcase :)

Virgil Dupras and others added 4 commits April 19, 2013 09:17
The local scope is no longer used to build the template context. It is now
explicitely built.
Conflicts:
	rosetta/conf/settings.py
	rosetta/tests/__init__.py
	rosetta/urls.py
	rosetta/views.py
Also, fixed the reflang feature, because the tests didn't pass anymore.

references #60
@ghost
Copy link
Author

ghost commented Aug 7, 2014

I've merge the PR with the latest develop branch and made sure that all test pass with the runtests_multi_venv.sh command.

Is there anything else I can do to make the PR move forward?

@ghost
Copy link
Author

ghost commented Aug 7, 2014

By the way, what about introducing a mocking library into the test suite? The current way of reverting old settings in the tests is a bit flaky/inelegant. If I were to submit a PR to that effect would that be welcomed?

@ghost
Copy link
Author

ghost commented Jun 21, 2015

@mbi, sorry for the repeated nudge, but is there anything I can do to help this PR go forward (other than repeatedly update from master)? Is the issue a simple lack of time on your part or are you hesitating to include this feature into rosetta?

@mbi mbi merged commit e4fd03f into mbi:develop Mar 22, 2016
@mbi
Copy link
Owner

mbi commented Mar 22, 2016

Apologies if this has taken so long, thanks for the awesome feature 👍

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