-
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
Cannot export to Ruby on Rails project as default placeholders are wrong #8
Comments
Thank you for your feedback! I wanted to double-check, how your translations look on Lokalise? Specifically, how placeholders are represented there? Do you use universal Lokalise placeholders? |
As a quick fix, you could try using Custom placeholders https://docs.lokalise.com/en/articles/5781985-custom-placeholders and Universal placeholders https://docs.lokalise.com/en/articles/1400511-lokalise-placeholders. For example, if your translation on Lokalise has the following contents:
Then you can enable Custom placeholders and provide the following data:
Then use Ruby on Rails YAML format and Raw placeholder format when exporting your data. |
Thanks @bodrovis ! We uploaded the YAML files from Ruby, and converted them to Universal Placeholders. For example |
We got access to the Custom Placeholders app, but it doesn't seem to format the data correctly when exported. And exported as Raw in YAML format, we still get Universal Placeholders in the export, like It might be that the Custom Placeholders app needs to be enabled before we import the translations to Lokalise the first time? Sadly this is not possible for us as the keys are already uploaded and translated. |
How does this gem usually work with a Rails project and |
Unfortunately I don't have any samples at hand, but let me try to double-check everything. It's strange because everything worked for me fine |
Yeah you know it's not working with the placeholder you are currently using. However this approach is working fine
|
Hi @bodrovis, are you suggesting that placeholder works in an Doesn't seem to work for me on
|
So, effectively my universal placeholders are presented as ordinary RoR YAML placeholders when using "raw" format |
Ah okay! There must be something wrong with how we uploaded our YAML files before, I assumed Would you have a way to get this Rails gem working out-of-the-box with Lokalise? And without using the Custom Placeholders App so we don't need to fix all our translated strings (4k+) 😄 |
Actually Also, the gem should be working out of the box with translations similar to this one: What was the original translation you tried to export?.. |
I've actually added another test case bodrovis/lokalise_manager@45ea245#diff-ffcc6c7c9aa007b1bd12983b91222c59ddcfe6917e2fd1cf6cef519f1edc8ee6R124 So, if I have the following translation |
And related to this, how did you get the placeholder I see the request parameters in the VCR cassette have |
I believe this is happening because you've enabled Custom placeholders. If you turn it off, you should see a plain old placeholder |
Okay I see, it's a bit of a hack then 😉 If you changed the default of this gem to Let me know if you get an answer from the team working on Custom Placeholders to support all types of Universal Placeholders and it should be good. A few lines in the documentation to explain that Universal Placeholders are only compatible with Rails if you use a Lokalise App would be great too! |
Unfortunately I don't think there's any easy solution with Custom placeholders, universal ones and Rails. If you need this feature, I'd suggest reporting it to the customer support team and they can forward it to product guys (it would be more appropriate as I'm not a member of CS). Also, I'll update the docs for Rails. In any case, thank you for reporting this and I'm sorry it tooks us a while to sort things out! |
Describe the bug
Hello, the default
format: :ruby_yaml
andplaceholder_format: :icu
does not work with a Ruby on Rails project with the default i18n setup using therails-i18n
gem.Ruby on Rails expects placeholders to be
%{my_placeholder}
but this gem exports as{my_placeholder}
when using type:icu
.I cannot get any combination of
format
/placeholder_format
for the file export to work with this gem and a Ruby on Rails project. Can you confirm how to use this gem?To Reproduce
config/locales
folder of a Ruby on Rails project{my_placeholder}
when translating a string, instead of using the replaced variable. This is due to Rails expecting%{my_placeholder}
Expected behavior
We expect that this gem should export as
%{my_placeholder}
, the only format supported by Ruby on Rails rails-i18n gem.Your environment:
Additional context
See how placeholders work in i18n interpolation documentation
https://guides.rubyonrails.org/i18n.html#passing-variables-to-translations
Checked with your support team to log a ticket, they suggested to go ahead. Thanks!
The text was updated successfully, but these errors were encountered: