How to use localize and i18n on client side - localization

I want to use localization from lokalise on my front-end project. But I don't like manually downloading files from Lokalise every time.
In Lokalise API I can get url to my localization file, but I don't see an option to use just the link in I18n. It seems I need to deploy a server to serve localization. Is there some possibility to use I18n with Lokalise like with locize: i18next-locize-backend. Or maybe there are another solutions?

Related

Modifying i18n locales and after Rails app initializes?

I'm trying to use I18n locales for a multisite application and wondering whether it's at all possible to load some extra translation locale files after the rails app has initialized?
I'm already using the excellent Globalize gem for ActiveRecord model translations, but I essentially want to be able to load the locales for a given site from it's own folder. I'm therefore trying to use something along the following lines in my site loader code:
I18n.load_path = File.join(site.path, 'locales')
Where the site.path variable relates to the current site's configuration & asset directory.
I don't want to rely on adding an i18n initializer to glob through the sites directory for locales for 2 reasons:
I can't guarantee a different site won't use the same translatable string, and I don't want them overwriting each other.
I don't want to have to restart the application each time a new site has been added.
If it helps, my logic to doing it this way allows for some sites to be multi language, and some not, and allows me to be lazy about whether a site is multi-language or not because if I can do the above successfully, I can use I18n.available_locales to determine whether or not to show the lanuage switcher in the admin app etc.

Export my Rails site to Phonegap

I want to use Phonegap for create light cellular version of my site.
Is there any way to save all my HTML`s and assets (after merge all the partials, create the entire assets pipeline items and convert haml and coffees to html and javascript)?
I want to use Rails for writing my client side code and save it.
Thanks!
It depends on the site - if it is mostly static content it should work, but any user interaction will need to be built knowing that the server won't be there when the app runs. Using rails as a compiler for something designed as a phonegap app will work a lot better than trying to package an existing website.
Actually generating the static site is easy enough though:
wget -m -nH www.example.com

What are the advantages of using Builder over regular xml files?

I have a Rails application which is using the Builder gem for writing easy to use XML files.
I am very much satisfied with the Builder gem but, as per my product architect's view, we should always use simple .xml files instead of using third party tools.
So, I need to give a solid justification to him explaining to him about the advantages of using Builder over regular XML files in our Rails application.
Can anyone give or guide me to a valid justification on the usage of Builder over regualr RXML/XML files in a Rails application?
If your xml files are static than he is correct and there is no benefit of friting them using any sort of xml template. If you are using it for dynamic content than you gain all of the benefit of template language such as sharing the code between templates, caching etc
He can be as high minded as he likes, but Builder 3.0 comes with any brand new rails 3 app. It's already in your gem bundle, why not utilize it? It's like saying ActiveRecord or JQuery shouldn't be used because we shouldn't rely on a third party tool. Since you're already using rails and all of the open source software that comes with it, what's wrong with Builder?
That being said, as Yuiry pointed out, the advantage is that builder is dynamic whereas a .xml is static.

Best options for translating a rails app

Since there are so many options there available for internationalization of a rails app, which gems or plugins are the best (today) for adding i18n support to a rails app.
Im using I18n bundled with rails for the application messages, button labels, and model attribue names.
But I also need to let the users to input content and the translated version of the content, but there are so many options for this right now that I don't really know which one to use.
We at Mynewsdesk (the guys behind the translate plugin) has moved on, now we're using Web Translate It to manage our locales. We've bloged about our translation workflow.
I like this one:
https://www.github.com/mynewsdesk/translate
because it has a nice webGUI for translating new/changed strings

Sass Compass multiple themes ruby on rails

I have a rails app that is a sort of CMS and i alow users to create their own version of the applicaton on a sub domain.
I also want to let them style their app version the way they want but changing a few fields or small config file.
I was hoping to be able to use sass and compass and be able to let users change varialbes for there own style.
How can i do this ? is it possible as saas needs to be compiled to css when varialbes are changed. i think?
Is there a better way ?
thanks alot
richard moss
It's possible to use Sass functions to access the outside environment; see the Sass documentation for details. Before you do this, make sure you'll be properly caching your stylesheets so that they don't need to be regenerated for every request.

Resources