Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

app is broken ? #1

Closed
deneuxa opened this issue Jun 4, 2014 · 3 comments
Closed

app is broken ? #1

deneuxa opened this issue Jun 4, 2014 · 3 comments

Comments

@deneuxa
Copy link

deneuxa commented Jun 4, 2014

I'm getting this error when trying to access to localhost:3000

Phrase::Api::Exceptions::Unauthorized in Tasks#index

Showing /Users/alexis/rails/demo-rails-app/app/views/tasks/index.html.erb where line #6 raised:

Error: Unknown Error (401)
Extracted source (around line #6):

Application Trace | Framework Trace | Full Trace
app/views/tasks/index.html.erb:6:in block in _app_views_tasks_index_html_erb___531558376134898250_70228402349560' app/views/tasks/index.html.erb:4:ineach'
app/views/tasks/index.html.erb:4:in _app_views_tasks_index_html_erb___531558376134898250_70228402349560' app/controllers/tasks_controller.rb:8:inindex'
Request

Parameters:

None

@fredv
Copy link

fredv commented Jun 4, 2014

Hi Alex, have you set your (or the demo account's) API Token?

It's in the initializer: config/initializers/phrase.rb line 7

I've just updated the code so that you can just run it with our public demo account API Token out of the box.

Please tell me if it works for you now. Please, tell me if we can help you setting up the in-context editor for your needs better or if we can assist you in getting started with PhraseApp.

@deneuxa
Copy link
Author

deneuxa commented Jun 5, 2014

Thanks, it's working for me now,
I wanted to test if metaprograming variables where working or not :

    <%- foo = 'bar1' %>
    <%= t("welcome_to_phrase_#{foo}") %>

=> it's OK the variable welcome_to_phrase_bar1 is proposed to me in the
editor

but I'm not getting some things for the whole process.

=> I created my new key in the layout (rails view)
=> set a french traduction with the live-editor (there were no
translations at all availables for the others keys)
=> then "phrase pull"

2 things surprised me :

  1. It created a new file phrase/phrase.main.yml : this file contain all the
    translation for a 'main' locale, shouldn't be a 'EN' locale ?
  2. my new key welcome_to_phrase_bar1 wasn't created, neither in the
    phrase.main.yml, neither in a new phrase.fr.yml that should have been
    created no?

How is it supposed to work ?
=> Should phraseapp be set in local: & staging and files used in production
or phraseapp should be used in production too ? (with the editor disabled)

=> where should I add a new key when developping ? in the phrase/_.yml
files ? or in my own locales/_yml files ?

thanks for your help

2014-06-04 23:03 GMT+02:00 Frederik Vollert notifications@github.com:

Hi Alex, have you set your (or the demo account's) API Token?

It's in the initializer: config/initializers/phrase.rb line 7

I've just updated the code so that you can just run it with our public
demo account API Token out of the box.

Please tell me if it works for you now. Please, tell me if we can help you
setting up the in-context editor for your needs better or if we can assist
you in getting started with PhraseApp.


Reply to this email directly or view it on GitHub
#1 (comment).

@fredv
Copy link

fredv commented Jun 5, 2014

Hi Alex,

but I'm not getting some things for the whole process.
=> I created my new key in the layout (rails view)
=> set a french traduction with the live-editor (there were no
translations at all availables for the others keys)
=> then "phrase pull"

Are you using your own trial account and its auth token or the demo account's auth token that I added to the project?

If so: It's easier to create a new account (less than 150 translation keys is free) and use the example projects auth token.

Main or default locale can be selected in the translation center, when you sign in to the account and go to your project's languages.

1 .Go to https://phraseapp.com/projects , sign in and go to Languages.

Here you can create a new locale and chose any locale as "Make default locale" on the right side of the Locale Settings. The locale name is also different from the locale or used language / dialect. You may have a locale named "main", but containing british english (en-GB). In Rails projects usually a 2 letter abbreviation of the language ("en", ISO 639-1 "English") or the version with dash and locale language version ("en-GB", ISO 3166-1 "British English").

2 things surprised me :

  1. It created a new file phrase/phrase.main.yml : this file contain all the
    translation for a 'main' locale, shouldn't be a 'EN' locale ?

The demo account is somewhat different as many people use it to play around and it may contain different locales. If you used your own account, is your english locale maybe named "main" ?
In standard setup we do not want to overwrite your local versions of the locales, therefore the name is prefixed. However, the folder where phrase stores locales and the naming of those files can be configured. General documentation here: https://phraseapp.com/docs/installation/phraseapp-with-ruby-on-rails?language=en and configuration guide for the gem is here https://phraseapp.com/docs/installation/phrase-gem?language=en

  1. my new key welcome_to_phrase_bar1 wasn't created, neither in the
    phrase.main.yml, neither in a new phrase.fr.yml that should have been
    created no?

The translation key is created on the first time it receives any translation content for it. You can either use a development or your default locale and add a translation and hit save or you can create keys by adding them to the default locale file and using "phrase push" to push changed keys to PhraseApp. There are gems that can either extract keys into a local locale file like https://github.com/shaiguitar/haml-i18n-extractor or even create internationalized versions of non-i18n partials https://github.com/douglasjsellers/herbgobbler. However, most commonly in iterative processes the locale file is amended by the developer that writes the partials. (Also because translations may be used in controllers, modules or other parts of applications).

How is it supposed to work ?
=> Should phraseapp be set in local: & staging and files used in production
or phraseapp should be used in production too ? (with the editor disabled)

The in-context editor should be used in a local or staging environment, it is a pre-production tool for copywriters or translators to see the placeholder's context. Before deploying we urge you to use "phrase pull" to download latest locale changes and use the /phrase/*.yml locales as locales for production or testing (e.g. on the build server) and commit them to the repo in order to deploy them with the repo to production. (Changes to locales may also happen in our web frontend, the Translation Center, e.g. when you order translations directly through our platform - many of our customers mainly use this platform).

You can integrate with the phrase API in any way you want (the phrase gem is merely a REST Client for our own API), but it is not intended for delivering live translation / content changes to your production system directly. (However, you could think of a background task or cron job that updates locales every couple of hours pro-actively.) Broken locales (e.g. localization, Yaml Arrays) may break production and although we try to offer validations for most common cases, translators may cause unintended Exceptions on production when able to make "live" changes.

=> where should I add a new key when developping ? in the phrase/_.yml
files ? or in my own locales/_yml files ?

New keys should be added in locales/.yml and then pushed to phrase via "phrase push".

thanks for your help

Your welcome! If you want, you can get in touch with us at any time in our support on UserVoice (http://support.phraseapp.com/).

@fredv fredv closed this as completed Jun 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants