codevise / pageflow-before-after

Page type for displaying before/after images.
0 stars 6 forks source link

Hardcoded German title #17

Closed tilsammans closed 7 years ago

tilsammans commented 7 years ago

The title Linke Maustaste drücken und nach links oder rechts ziehen is hardcoded in widget.js.

How can I help in moving it to an i18n-based solution?

tf commented 7 years ago

Good catch. We missed that so far. Please prepare a PR to the pageflow-public-i18n repository that adds at least an English and the existing German translation. There already is a pageflow.public.before_after scope, maybe it makes sense to add it there. Then I can release a new version of the pageflow-public-i18n gem and we can merge a PR for the pageflow-before-after gem that depends on the new version and replaces the hard coded string with an I18n.t call (provided by i18n-js).

tilsammans commented 7 years ago

@tf first step done; could you release a new version of pageflow-public-i18n?

I took the liberty of refactoring the string concatenation; see my work in progress on https://github.com/scrollytelling/pageflow-before-after/tree/i18n. I hope it's fine to do that at the same time.

tf commented 7 years ago

Refactoring looks fine - more idiomatic jQuery I guess. Just put it in the same PR.

tf commented 7 years ago

pageflow-public-i18n version 1.8 is released.

tf commented 7 years ago

Also I think this is the first time that we add a key where we cannot come up with translations for all locales right away. So we'll have to make sure that fallback to en works for those others locales which are still lacking the new key.

tilsammans commented 7 years ago

Fallbacks are used by default as per the README.

I don't think we're using the recommended setup in Pageflow?

<script type="text/javascript">
  I18n.defaultLocale = "<%= I18n.default_locale %>";
  I18n.locale = "<%= I18n.locale %>";
</script>
tf commented 7 years ago

We already do something like that in the entries/edit.html.erb template. We probably have to add it to the helper used by published entries ([1], [2], [3]) as well.

tf commented 7 years ago

I've done some work regarding locale fallback for public translations in codevise/pageflow#757

tilsammans commented 7 years ago

I created #19 to depend on the released i18n version. Also see my note regarding SemVer, and optionally depending on ~> 1.8. I am not sure how much (in)stability you expect in these i18n keys.

Not sure how to proceed with regards to the fallback, I think your changes fix a majority of issues?

tf commented 7 years ago

Fallback should work starting with Pageflow 12.