The discussion revolves around the issue of the missing earth icon after configuring the Google Translator API. Guo_SpicyGum shares error messages indicating that requests from an empty referer are blocked.
pfaffman suggests that the issue might be due to an invalid key for accessing the translator and advises re-copying or re-generating the key. However, Guo_SpicyGum confirms that the API Key is correct.
Arkshine identifies the problem as website restrictions and the API expecting a Referer header in the request. They suggest adding headers to the API request or trying alternative restriction methods.
With Arkshine’s help, Guo_SpicyGum is able to pass the test successfully but still faces issues with the earth translation icon not appearing.
Why is there no earth icon after I configured the Google Translator API?
root@talk:/data/discourse# ./launcher enter app
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
root@talk-app:/var/www/discourse# rails c
[1] pry(main)> DiscourseTranslator::Google.detect(Post.last)
DiscourseTranslator::TranslatorError: {"error"=>{"code"=>403, "message"=>"Requests from referer <empty> are blocked.", "errors"=>[{"message"=>"Requests from referer <empty> are blocked.", "domain"=>"global", "reason"=>"forbidden"}], "status"=>"PERMISSION_DENIED", "details"=>[{"@type"=>"type.googleapis.com/google.rpc.ErrorInfo", "reason"=>"API_KEY_HTTP_REFERRER_BLOCKED", "domain"=>"googleapis.com", "metadata"=>{"service"=>"translate.googleapis.com", "consumer"=>"projects/390801787023"}}]}}
from /var/www/discourse/plugins/discourse-translator/services/discourse_translator/google.rb:134:in `result'
It looks like you have not supplied a valid key for accessing the translator. I would check that you have supplied payment and re-copy or re-generate the key.
root@talk:/data/discourse# ./launcher enter app
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
root@talk-app:/var/www/discourse# rails c
[1] pry(main)> DiscourseTranslator::Google.detect(Post.last)
DiscourseTranslator::TranslatorError: {"error"=>{"code"=>403, "message"=>"Requests from referer <empty> are blocked.", "errors"=>[{"message"=>"Requests from referer <empty> are blocked.", "domain"=>"global", "reason"=>"forbidden"}], "status"=>"PERMISSION_DENIED", "details"=>[{"@type"=>"type.googleapis.com/google.rpc.ErrorInfo", "reason"=>"API_KEY_HTTP_REFERRER_BLOCKED", "domain"=>"googleapis.com", "metadata"=>{"service"=>"translate.googleapis.com", "consumer"=>"projects/390801787023"}}]}}
from /var/www/discourse/plugins/discourse-translator/services/discourse_translator/google.rb:134:in `result'
Thank you very much for your help, with the above I have been able to pass the test successfully. But I found that I still have the earth translation icon.
root@talk-app:/var/www/discourse/plugins/discourse-translator/services/discourse_translator# rails c
[1] pry(main)> DiscourseTranslator::Google.detect(Post.last)
=> "en"
[2] pry(main)>