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
Added the ability to specify translations for the default language #2909
Added the ability to specify translations for the default language #2909
Conversation
Allows to override the default language without modifying the templates
@LaurentGoderre could you give more context about why this is needed and what is the effect of this PR? |
This allows changing english ckan strings without modifying all the templates where they are defined. For example, it was requested that we change all instance of the word dataset to the word record. Instead of changing all the 200+ templates where it occurs, this takes care of that requirement. Most people probably won't need this but it's a neat feature to have. |
|
||
try: | ||
i18n.set_lang(lang, pylons_config=fake_config, class_=Translations) | ||
except i18n.LanguageError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were not capturing and ignoring these before, is this needed by the new behaviour (supporting en
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, if you don't have an english override, it triggers that exception saying 'english is not found'. So by trapping it this way, if there is no english override or if they use a missing language, it will revert to the default language
@LaurentGoderre, changing "Dataset" to "Record" should have already been possible by using ckan.i18n.extra_directory and dropping an extra translation file in. Or by adding an english translation in your extension there's an example one in ckanext folder. It was used a few times to just change the "Organization" string and we used it in ckanext-showcase if I recall. What is your default language set as, it's possible there is a slight different case which I didn't account for when I wrote this. |
The english translation file are ignored because they are the default without this changed |
If english is default, then there should be no translation object in pylons , this case should be handled by I'll take a look again as it's been a while since I looked at this. |
If you can show me some code that makes it work it would be appreciated. I couldn't get it to work |
@khayo36 please check the docs http://docs.ckan.org/en/2.8/contributing/i18n.html |
We decided to close old pull requests that are not actively worked on so that we can focus our effort and attention on PRs made against the current version of CKAN. A lot has changed in the last several months and many PRs will have gone stale or may now be in conflict with the latest version. Please note: this isn't a judgement about the quality of your pull request. We just don't have the resources to review older PRs. If you would like to reopen your PR (and update it if necessary), please do! |
Allows to override the default language without modifying the templates