Git Product home page Git Product logo

Comments (3)

fredv avatar fredv commented on August 12, 2024

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.

from demo-rails-app.

deneuxa avatar deneuxa commented on August 12, 2024

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 [email protected]:

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).

from demo-rails-app.

fredv avatar fredv commented on August 12, 2024

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/).

from demo-rails-app.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.