berk / tr8n

This repository has moved to:
https://github.com/tr8n/tr8n
MIT License
280 stars 37 forks source link

Sync feature? #28

Open fabn opened 12 years ago

fabn commented 12 years ago

Does the sync feature works only with tr8n.net?

It would be useful if that feature can be used also across private servers to allow translation be made on staging server and then synched with production server.

Is that possible?

berk commented 12 years ago

I didn't build it in because i thought there were other faster ways of sharing translations between your own servers. But if you think it is necessary, i could enable it as well.

Some companies create a separate tr8n database and share it between their translation server and production server. You can set your translation server to have a threshold of 1 - which means any submitted translation will be immediately displayed and your production server threshold at 3 - which would only let translations with total rank of 3 be displayed. Then you can set your language managers to have a higher voting power and have them approve the translations before they are used on production.

You can create an initializer for tr8n:

Add tr8n.rb in config/initializers and force the connection of tr8n models to point to the shared database:

tr8n.rb

Tr8n::Config.models.each do |model| model.establish_connection(your_spec) end

fabn commented 12 years ago

That could not be an option in some environments because of firewalls or other restrictions. Since I read a part of your code I saw that there is a support for the sync api in the engine but it's pretty undocumented. So if it's not hard to enable sync also for private server it would be nice to have in future releases.

For my environment I'm trying to do something similar to what you've written, so thanks for the hint, it will be useful.

Off theme: You made an awesome gem, I've coded a lot of multi language web applications and tried every approach (yml, gettext, plain php array, and so on) and I think your approach is the best when translators are not developers. The only problem for this gem in my opinion is the lack of documentation and missing specs. Is there future plans to improve these aspects?

berk commented 12 years ago

Good point. I will add the in-network synching mechanism for local servers as well. But the overall goal is to use tr8n.net as a DTMR - distributed translation memory registry and have other servers that run tr8n and use TML (translation markup language used by tr8n) exchange translations with each other.

Regarding specs and documentation - you are right, i am behind and i will do my best to try to catch up.

Btw, If you are interested in helping out, you are more than welcome to fork the repository and send me pull requests. Also if you know PHP, we need to create a PHP ClientSDK so PHP apps can use tr8n server as well.

Where are you located and what websites have you used tr8n on? Just curious.

fabn commented 12 years ago

For the php part: I've almost left php development and switched to RoR mainly for the high extensibility of this language and for the gem mechanism itself. In php a beautiful app like tr8n (or any other engine like active admin) could not be even thinked.

I've found your project less than one month ago while looking for something that will help external translators, so I've not released a production app yet. I'm integrating it right now in a project which is still in preproduction stage.

I think you should promote your gem to give it more visibility in order to get community support, I've suggested your project in the Ruby Toolbox website. This engine could be the definitive solution for translating a web app.

I'd like to help your development and I will try to do that during this experiment. I've already forked it to show it to a coworker since your version has an issue with the SQLite database. I will try to fix it and submit a patch.

berk commented 12 years ago

Thank you for your feedback. I haven't done any promotions yet. The best promotion is a good product and a word of mouth. Well, if Rayn Bates shows it off or if i get to present it at RailsConf - wouldn't hurt either. :) I have posted my latest slides here: http://wiki.tr8n.org/slides - they should clarify some things that are not in the documentation.

krunal commented 9 years ago

I have created rake task to import/export translations from a specific server.

Gist - https://gist.github.com/krunal/f3c8a543982aba01dd7b

Steps to copy translations from 'Server A' to 'Server B' (Basic Tr8n needs to be setup on both server before executing following steps)

1) ssh to Server A 2) Execute -> rake tr8n:export_translations 1) Rake will nullify synced_at column 2) Rake will restart Memcached 3) Rake will prompt you to enter a filename 4) Rake will create a new filename.yml file inside your root directory. 3) scp this filename.yml from 'Server A' to 'Server B' 4) ssh to Server B 5) Execute -> rake tr8n:import_translations 1) Rake will restart Memcached 2) Rake will prompt you enter a filename 3) Translations will be imported from the specified file 6) Done!

In case, If this can help someone :-)