onesky / onesky-rails Goto Github PK
View Code? Open in Web Editor NEWRails plugin to sync string files with OneSky
License: MIT License
Rails plugin to sync string files with OneSky
License: MIT License
While the i18n_one-sky gem the one_sky.yml is parsed through ERB, this is not the case with onesky-rails, which leads (in my case but I guess I'm not the only one) to a sensitive data issue.
As I use figaro to keep sensitive values centralized, I would like to do the same with the one sky gem, and embed ERB tags in the onesky.yml.
Unless ERB parsing was removed for a reason ? Please let me know. Anyway I'd like to submit a PR for this.
For instance, I have a rails app with <%= t('key') %>
in the whole project but I did not specify them inside locales/en.yml or other file. It would be cool to automatically upload those keys to the platform without adding them separately to .yml file and then uploading.
There is a problem when downloading files that does not fit the standard style (en.yml), for instance, devise.en.yml.
When you use the gem to download the file, the name is not translated to the suitable locale, f.ex. if we want to translate it to spanish the name is not renamed to devise.es.yml and remains as devise.en.yml
Gem doesn't work on rails 4.2 because dependencies.
onesky-rails (>= 0) ruby depends on
onesky-ruby (> 1.0.0) ruby depends on> 1.7.2) ruby
rest-client (
Where rails 4.2 uses rest-client 1.8.0
As the gem is using the list of files on the disk, when running the rake onesky:download_base
task, in case there is a new file on the local disk, it failles with a 400 Bas Request.
1.4.1 is described in the CHANGELOG (not as "future release"):
db09c0b
However, the last version of onesky-rails on RubyGems is 1.4.0: https://rubygems.org/gems/onesky-rails
Are there any plans to fix that, or do I need to point to the GitHub repository in my Gemfile?
The fix that was added in 1.4.1 (Upgrading the onesky-ruby dependancy gem) helps resolve a gem version lock conflict, and will allow our project to upgrade the rest-client gem and support recent versions of other gems that use it.
Given I have updated the base language texts, when I run rake onesky:download
or rake onesky:upload
it should also update the base language files.
Hi,
I don't know what changed these days, but I have problems with some of my translations. Just happens to the ones that are arrays of values and the first value is empty. I have tried older versions of the gem and still happens the same. Do you think it's related to the API? Was working few days ago. Here an example:
Original file from the rails i18n repository: https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml
abbr_month_names:
-
- Jan
- Feb
- Mar
- Apr
- May
- Jun
- Jul
- Aug
- Sep
- Oct
- Nov
- Dec
Can be uploaded and translated without problems. Errors appear when downloading the translation.
abbr_month_names:
? "12"
: dic
? "0"
: ~
? "1"
: ene
? "2"
: feb
? "3"
: mar
? "4"
: abr
? "5"
: may
? "6"
: jun
? "7"
: jul
? "8"
: ago
? "9"
: sep
? "10"
: oct
? "11"
: nov
Tried changing the format of original file to an array like:
[, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
or even
[~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
but no luck.
Any tips on how to solve it?
I started using onesky-rails in replacement of i18n-one_sky today, because as I removed the 'Default' from my translation source files, I encountered the error mentionned in this issue : onesky/i18n-one_sky-ruby#8
So here I am. And for some reason (due to missing information in the api response suposately) Here is the output of the task onesky:download :
demental$ rake onesky:download
onesky_en_GB/
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
en-GB.yml
onesky_es_UY/
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
es-UY.yml
onesky_pt_PT/
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
pt-PT.yml
onesky_es_419/
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
es-419.yml
As I suspected with this output, each downloaded translation file would replace the previous one, so while it should comply to the base locale file structure, it doesn't, and I can't properly download the translations.
I suggest one should name the downloaded files after the existing base file structure, and not after the API attachment response. I'll try to submit a PR within the end of the day to achieve this.
Given the base language of the application is English
And the application is translated in French
And an English translation YAML file contains a table as the following:
en:
days:
- Monday
- Tuesday
- Wednesday
- Tuesday
- Friday
- Saturday
- Sunday
When I upload this file to the OneSky platform
And I download the French translation files
Then I see the following file:
fr:
days:
? "1"
: Mardi
? "0"
: Lundi
? "2"
: Mercredi
? "3"
: Jeudi
? "4"
: Vendredi
? "5"
: Samedi
? "6"
: Dimanche
While I expect to see the following file:
fr:
days:
- Lundi
- Mardi
- Mercredi
- Jeudi
- Vendredi
- Samedi
- Dimanche
Given I'm using languages English and French. In the case I have a file menu.yml
, the French file is renamed as mfru.yml
.
The en
has been replaced by fr
while it shouldn't.
I have a folder structure for organizing my translations, but sometime the files have the same filename - and then I only get to keep one of the files on onesky.
Would there be a way to append to the filename based on folder structure?
Or keep multiple files with same filename? (Guess that would lead to problems with duplicates).
Example: how should it understand the difference between:
config/locales/views/users.sv.yml
and config/locales/views/admin/users.sv.yml
or is the only option to rename one of the file?
I use it with gettext(fast_gettext) gem.
Their file load at Rails.root/locale/*
Can I upload *.po file in {Rails.root}/locale
My opinion is that files downloaded using the gem should be identical to those downloaded manually via the web site.
In our team, some of us use the rake tasks but others still download files via the website. This makes the header comment to be added and deleted continuously in our Git version control:
At least it should be optional and configurable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.