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

Translation project completion #5737

Open
2 of 4 tasks
grvsachdeva opened this issue May 18, 2019 · 25 comments
Open
2 of 4 tasks

Translation project completion #5737

grvsachdeva opened this issue May 18, 2019 · 25 comments
Assignees
Labels
planning Planning issues!

Comments

@grvsachdeva
Copy link
Member

grvsachdeva commented May 18, 2019

Here's the list of remaining tasks of Translation project:

  • Translation prompt improvement - Translation prompt improvement #5651
  • Updating all the Translation wikis/notes on the publiclab.org
  • Adding documentation for Translation
  • [Add new here]

cc @jywarren

@grvsachdeva grvsachdeva added the planning Planning issues! label May 18, 2019
@grvsachdeva grvsachdeva self-assigned this May 18, 2019
@grvsachdeva
Copy link
Member Author

Updating Translation wikis/notes:

  1. https://publiclab.org/wiki/translation - Updated. @jywarren I have replaced the video here as the old video was not available anymore. The current video is more like an introduction to Transifex so if you want I can record a video of translation activity with Public Lab as an example? or, check out https://www.youtube.com/user/TransifexInc/feed and suggest a video which seems relevant.

  2. The second page is https://publiclab.org/notes/liz/10-26-2016/how-to-join-public-lab-s-transifex-project a note written by @ebarry. I have some improvements in mind for that. Can I edit that note?

Thanks!

@ebarry
Copy link
Member

ebarry commented May 30, 2019

hi @gauravano i have made you a co-author of that note, please edit as you see fit! Thanks!

@grvsachdeva
Copy link
Member Author

Thanks, @ebarry !!

@grvsachdeva
Copy link
Member Author

Hey @publiclab/community-reps, I have did some changes to Language dropdown and also added new languages, check it out 👇

footer_translate_design

What do you think about this design? If you like it, I will update the feature. Thanks!

@ebarry
Copy link
Member

ebarry commented May 30, 2019

i like it, and look forward to a future moment when we make the language option more visible :)

@grvsachdeva
Copy link
Member Author

I am thinking of an enhancement -- Suppose a user browses a website from China then using their location we can show this language menu to them in the notice or somewhere at top of the website? What do you think @jywarren @ebarry?

Also, I have updated https://publiclab.org/notes/liz/10-26-2016/how-to-join-public-lab-s-transifex-project note with the latest screenshots.

@ebarry there are some more research notes tagged translation. I will go through all of them and so want to ask can I update wherever necessary? you don't have to go through the trouble of making me co-author at all of them as I already have admin privileges so can edit those notes, but just want to ask a would that be fine with you? Thanks!!

@jywarren
Copy link
Member

Are the dropdown changes in a feature, and do they need to be added to the live site? Cool!

One thing if you haven't already, is to clearly show people how to enable the "see translation prompts everywhere" setting -- which, ok it was a while ago -- i think was driven from a profile tag? We could advertise this and get some language growth going, then consider switching it from an opt-in to an opt-out to see it really grow?

@grvsachdeva
Copy link
Member Author

Are the dropdown changes in a feature, and do they need to be added to the live site? Cool!

yes! Here's the gist - https://gist.github.com/gauravano/1124fff46ae156537e6fb712bff9e980

@jywarren yes, currently profile tag enables the translation prompts. Yes, I am thinking of writing a note. What do you think? For making it easy to enable translation prompts, we can add a button on the profile page or somewhere else?

Thanks!

@jywarren
Copy link
Member

jywarren commented May 31, 2019 via email

@jywarren
Copy link
Member

jywarren commented May 31, 2019 via email

@jywarren
Copy link
Member

jywarren commented May 31, 2019 via email

@grvsachdeva
Copy link
Member Author

So, with the right profile tag, should I be seeing the prompts on every
page?

Only on pages where I replaced default t helper with custom translation helper like this https://github.com/publiclab/plots2/blob/master/app/views/dashboard/dashboard.html.erb#L47 . I will document it and some more things today.

sure, yeah! Also, the "people" grid feature on this page could be used to
prompt people to add that profile tag to themselves:

@jywarren you added such button here - https://publiclab.org/wiki/translation a month ago. Should we add it to more pages?

@jywarren
Copy link
Member

jywarren commented May 31, 2019 via email

@grvsachdeva
Copy link
Member Author

We need to change t to raw translation in views. We can do it wherever we want. Currently, they are on /blog, /dashboard and /subscriptions. I can add them everywhere. What do you think about that?

Thanks!

@jywarren
Copy link
Member

jywarren commented Jun 3, 2019

Yes, let's do the t to translation conversion now, I'm pretty happy with how this is working, and people can turn it on and off via profile tags anyways! Thanks, this is AWESOME Gaurav!

I am thinking of an enhancement -- Suppose a user browses a website from China then using their location we can show this language menu to them in the notice or somewhere at top of the website? What do you think @jywarren @ebarry?

I think this sounds good but i think we can detect the languages settings of the user's browser, rather than guessing based on location. That way if someone doesn't speak one of the primary languages of a country their browser settings will still try to show them the site in that language.

@jywarren
Copy link
Member

jywarren commented Jun 3, 2019

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language maybe?

@grvsachdeva
Copy link
Member Author

grvsachdeva commented Jun 3, 2019

Sure, headers are always helpful (and resourceful 😅 ). I will start on this enhancement after updating the notes/wikis related to translation. @jywarren @ebarry so can I go ahead and update the research notes- https://publiclab.org/tag/translation using my admin privileges?

@jywarren
Copy link
Member

jywarren commented Jun 4, 2019 via email

@grvsachdeva
Copy link
Member Author

Thanks, @jywarren for confirming! Also, don't you think what I am currently doing is somewhat similar to @steviepubliclab's note - https://publiclab.org/notes/stevie/05-24-2019/idea-to-distribute-tasks-for-a-reserach-area-review. But, I think, it'll cover only wikis but if that covers research notes too, then co-authors would be added or the reviewers need to be given admin privileges 🤔.

Will update in 2 days and then throw final documentation for pushing and pulling translations and helper methods.

@jywarren
Copy link
Member

jywarren commented Jun 6, 2019 via email

@jywarren
Copy link
Member

Ok just confirming that any t(...) can be replaced with a new, special translations(...) method in Ruby, as in this comment by @gauravano?

If so, @publiclab/gci I think this would make a lot of really nice GCI tasks!

@jywarren
Copy link
Member

Finding instances of the old t() method is a little harder than I thought, as the GitHub search doesn't work, so I think a "grep" based search in Linux would work but it's not as easy to do:

grep -r "t(" app/views

It should return lines like this one!

| <%= number_with_delimiter(@node.views) %> <%= t('notes.show.views') %>

@nstjean
Copy link
Contributor

nstjean commented Oct 25, 2019

I am having success in Visual Basic Code by searching for \st\( - space t (

@grvsachdeva
Copy link
Member Author

grvsachdeva commented Oct 28, 2019

Ok just confirming that any t(...) can be replaced with a new, special translations(...) method in Ruby, as in this comment by @gauravano?

Hi @jywarren @nstjean, yeah, t(..) can be replaced by translation(...). The code for translation is in helpers/application_helper.rb.

NOTE: After replacing, testing that view is necessary as it may not work for complex blocks like div, span, etc.

And, if corner cases need to be handled, then one can change the helper definition.

All the instances can be found from RubyMine too or any editor as @nstjean also mentioned an example. I will say, create a list of files here as a checklist and then create issues so as to have no confusion or duplicate issues.

Thanks!

@jywarren
Copy link
Member

Hi, I'm thinking we should create fall-back text in this prompt as well, and finish documentation (I've started here: https://github.com/publiclab/plots2/blob/master/README.md#internationalization)

def translation(key, options = {})
translated_string = t(key, options)
options[:fallback] = false
translated_string2 = t(key, options)
if current_user&.has_tag('translation-helper') && translated_string2.include?("translation missing") && !translated_string.include?("<")
raw(%(<span>#{translated_string} <a href="https://www.transifex.com/publiclab/publiclaborg/translate/#de/$?q=text%3A#{translated_string}">
<i data-toggle='tooltip' data-placement='top' title='Needs translation? Click to help translate this text.' style='position:relative; right:2px; color:#bbb; font-size: 15px;' class='fa fa-globe'></i></a>
</span>))
else
raw(translated_string)
end
end

For new strings, we could, if there is no text yet available, offer this syntax:

translate('dashboard.post_content', { fallback: "Post some content" }

We are currently passing :fallback into the t() helper. What does that do? I don't see it documented here: https://guides.rubyonrails.org/i18n.html#adding-translations

@stale stale bot added the stale label Oct 7, 2020
@cesswairimu cesswairimu removed the stale label Oct 7, 2020
@publiclab publiclab deleted a comment from stale bot Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
planning Planning issues!
Projects
None yet
Development

No branches or pull requests

5 participants