-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Old version of lokalise_rails is installed / Import not working #12
Comments
Good day! Please post full contents of your |
As for the second exception, I believe here's the workaround https://stackoverflow.com/questions/71332602/upgrading-to-ruby-3-1-causes-psychdisallowedclass-exception-when-using-yaml-lo |
Hi there! Thanks for the quick response :-)! My ruby version is 3.0.4! The Gemfile looks like so:
I found this link here (https://stackoverflow.com/questions/71332602/upgrading-to-ruby-3-1-causes-psychdisallowedclass-exception-when-using-yaml-lo) as well, but sadly it didn't change anything for me :/! |
I believe the problem arises because of the So, effectively there are two possible solutions:
Now, as for the problems with Pshych, I don't think these are related to the LokaliseRails gem. Most likely, you have some unexpected characters in the YAML translation files themselves, and the loaders complains about these. I believe adding the following line to the
This is a more radical yet unfsafe approach, perhaps it'll help (though I have to say it really is unsafe):
If nothing helps, please paste the contents of your translation file, I'll try to look into it |
Hey, @bodrovis ! Thank you for your quick responses! They were super helpful! The second solution was to throw out symbolized values and use strings for values instead. Another question: Is it possible to use more than just one path? Thank you in advance! Kind regards Daniel |
Good day! Unfortunately, by default the gem works only with a single path. However, you can try this approach https://github.com/bodrovis/lokalise_rails#running-tasks-programmatically Basically, one should create a script to perform importing/exporting, inherit from the global settings (though it's not mandatory) and set per-client options. Here's a very raw example: require "#{Rails.root}/config/lokalise_rails.rb"
importer = LokaliseManager.importer({locales_path: "#{Rails.root}/custom_path/locales"}, LokaliseRails::GlobalConfig)
importer.import! In the example above we override the global options with a custom locales path, and then start the importing process. If needed, all the options can be customized, including the API token, file format, and so on. Basically, inside this script you can create as many importers or exporters with custom locale paths. These can be regular Ruby scripts, or you can create custom Rake tasks by using the base task as an example https://github.com/bodrovis/lokalise_rails/blob/master/lib/tasks/lokalise_rails_tasks.rake#L7 |
Here's a full example with a custom Rake task that uploads translations to Lokalise from two different paths: require 'rake'
require 'lokalise_rails'
require "#{LokaliseRails::Utils.root}/config/lokalise_rails"
namespace :lokalise_custom do
task :export do
# importing from the default directory (./config/locales/)
exporter = LokaliseManager.exporter({}, LokaliseRails::GlobalConfig)
exporter.export!
# importing from the custom directory
exporter = LokaliseManager.exporter({locales_path: "#{Rails.root}/config/custom_locales"}, LokaliseRails::GlobalConfig)
exporter.export!
rescue StandardError => e
abort e.inspect
end
end |
Thank you very very much for your effort! I will try this out within the next few hours and give you feedback to this! |
No problems at all, I'm glad to help :) |
I'm going to close the ticket but feel free to reopen if this is still relevant. |
Hi there!
I tried to install lokalise_rails 5.2.0 but this is not working due to this error:
If I use the default version (4.0.0, if you don't specify a version), the following error is shown during import:
The text was updated successfully, but these errors were encountered: