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

switching translation is hard #76

Open
realsobek opened this issue Apr 13, 2016 · 10 comments
Open

switching translation is hard #76

realsobek opened this issue Apr 13, 2016 · 10 comments
Assignees

Comments

@realsobek
Copy link

I am using JournalTouch 0.4.1 on CentOS 7 x86_64 with centos-release-scl package and packages:
php55
php55-php
php55-php-mbstring

When I visit:
http://journaltouch/admin/settings.php -- Translations

and change Default language from 'de_DE' to 'en_US' and clicked on [Save] it seems to be fine.
However, after saving I visit:
http://journaltouch/
and the buttons in top bar remain in German by default.

My workaround was to:

  1. http://journaltouch/admin/settings.php -- Translations -- Default language and languages enabled for switching -- Enabled languages (multiple choice): disable "de_DE"
  2. http://journaltouch/admin/settings.php -- Translations -- Default language and languages enabled for switching -- Default language: set "en_US"
  3. click on [Save]

Then I visited again:
http://journaltouch/

This created lots of output in the log file:
tail -f /var/log/httpd24/error_log

[Wed Apr 13 11:31:28.413418 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined property: stdClass::$language_default in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/sys/bootstrap.php on line 36, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.421672 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 69, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.421717 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 87, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.421900 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 99, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.421912 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 105, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.421963 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 160, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.421992 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 178, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.422002 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 179, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.422013 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 190, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.422021 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 191, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.422030 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 200, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.422054 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 226, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.422075 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 238, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.423423 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 434, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.423529 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 452, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php
[Wed Apr 13 11:31:28.423562 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 453, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php

NOTE: removed multiple repetitions of previous 'line 434, line 452, line 453' messages

[Wed Apr 13 11:31:28.424646 2016] [:error] [pid 882] [client 141.14.232.200:34496] PHP Notice: Undefined index: in /opt/rh/httpd24/root/var/www/html/bibliocoll-JournalTouch-869729f/index.php on line 519, referer: http://journaltouch.mpikg.mpg.de/admin/settings.php

I can change other settings in http://journaltouch/admin/ without output in log file.

@krugar krugar self-assigned this Apr 14, 2016
@krugar
Copy link
Contributor

krugar commented Apr 14, 2016

quick note: the translations for the parts you mentioned aren't part of the php-gettext based i18n, but can be set in /admin/settings.php#formTab3

going to look into this later today

@krugar
Copy link
Contributor

krugar commented Apr 15, 2016

i ran into a very similar error with an outdated data/config/config-default.php:

[:error] PHP Warning:  Creating default object from empty value in data/config/config-default.php on line 187, referer: admin/settings.php
[:error] PHP Warning:  Creating default object from empty value in JournalTouch/sys/bootstrap.functions.php on line 238, referer: admin/settings.php
[:error] PHP Notice:  Undefined property: stdClass::$language_default in sys/bootstrap.php on line 36, referer: admin/settings.php
[:error] PHP Notice:  Undefined index:  in index.php on line 69, referer: admin/settings.php
[:error] PHP Notice:  Undefined index:  in index.php on line 87, referer: admin/settings.php
[:error] PHP Notice:  Undefined index:  in index.php on line 99, referer: admin/settings.php
[:error] PHP Notice:  Undefined index:  in index.php on line 105, referer: admin/settings.php

and so on...

maybe we should move any non-user data out of the data folder, so people can (in principle, disregarding patchlevels...) just copy the folder around?

@krugar
Copy link
Contributor

krugar commented Apr 15, 2016

foundation-select.js requires an unique id-attibute on each select element it should transform, that was missing on the default_lang one, which lead to the javascript-replacement-select widget to not update the hidden actual select element that was part of the form, thus not actually changing the value.
hopefully the above commit fixes the problem you encountered

@realsobek
Copy link
Author

With 0.4.2 switching languages works for me. Thank you :)

By comparing:
http://journaltouch/index.php?lang=de_DE
to:
http://journaltouch/index.php?lang=en_US
I noticed that [About] is not translated. I am not sure, if this is a bug or intentional.
If it is intentional, feel free to close this issue.

@krugar
Copy link
Contributor

krugar commented Apr 16, 2016

the lowercase "about" in the top bar happens in index.php#L92, if i'm not mistaken, and that should get translated by php-gettext (into "über"), so if you meant that one, something is still amiss

@tzeumer
Copy link
Contributor

tzeumer commented Apr 16, 2016

Just a note. My idea was that finally everything a user sees will be easily translatable in the backend. I'd keep gettext for the backend itself. Still, I didn't put everything into the settings page on purpose. For some it is not so easy to explain where they show up (or why even twice as it is the case with "about") and thus it would become somewhat confusing. These are the strings that are translated by gettext on the front page:

  • "menu"
  • "about"
  • "show all"
  • "new issues"
  • "About"
  • "Get in touch!"
  • "External Source"
  • "Tagcloud"
  • "Your basket is empty."
  • "Send/Save my articles"
  • "Empty my basket"
  • "Do you really want to empty your basket?"
  • "OK, empty my basket!"
  • "No, keep basket!"
  • "Top Journals"
  • "Filter active:"
  • "Search journal"
  • "No journals found"
  • "Via JournalTocs"
  • "RSS"
  • "Via CrossRef"
  • "No toc available"
  • "last update"
  • "Something seems to be wrong with the network"
  • "Please notify us!"
  • "No table of contents found! Are you interested in this title?"
  • "Tables of contents provided by CrossRef and JournalTocs"
  • "Touch me!"
  • "What is this?"
  • "Touch the screen to get started..."
  • "remove"

I don't check the ones in the checkout page since I understand, that there is new code coming anyway (sessions).

@realsobek
Copy link
Author

I am sorry, I meant the lowercase "about" in the top bar.
If you click on it, the pop up window contains the uppercase "About". It is not translated as well.

index.php#L92 really is the line. The line number matches the reference in messages.po.
However, if you look at index.php in a browser the same line is on line 30. I am not sure, if this is the reason for the broken translation.
Do you think I am missing a package?

To me it seems that all strings that should be translated with:
languages/de_DE/LC_MESSAGES/messages.po
are not displayed in translated text.

On 'http://journaltouch/index.php' the text of the floating button is translated from 'Send articles' to 'Artikelliste schicken'.

@tzeumer
Copy link
Contributor

tzeumer commented Apr 17, 2016

@krugar I think I already mentioned it somewhere: this codespell-thingy also went into the po files (and did stuff like translating german "Autor" to "author"). Maybe this broke something more..?

The line numbers shouldn't be too important. I change lines in the code all the time without breaking gettext translations.

@krugar
Copy link
Contributor

krugar commented Apr 17, 2016

i had taken a look at the german translation file and i couldn't spot the "author" thing you mentioned. i have a hunch thatvrunning msgfmt again might help, i'll check when i'm back at the office tomorrow

@tzeumer
Copy link
Contributor

tzeumer commented Apr 17, 2016

I might be wrong, I just thought I saw something like that. :)

(Oops, it's already sunday - somehow I'm missing a day sigh :D)

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

No branches or pull requests

3 participants