Locale/localeapp

`localeapp pull` sometimes takes forever to reflect added translations.

sarojkh opened this issue ยท 16 comments

Most of the times, after adding a translation, localeapp pull instantly pulls down the newly added translation, but sometimes, it takes more than an hour to do so.

Is this an intermittent issue others have faced as well? Searched through past issues to find no such experience.

Hi @sarojkh,

We will investigate if every thing is OK with the cache, maybe you found a case where it is not correctly expired.

Thank you for your feedback.

@thibaultdalban I actually tried to pull what I added 2 days ago. But, the update isn't reflected in my local translation file. When I retry adding the translation, it doesn't hint of any errors; I get the following feedback.

Sending key: <redacted>
Success!

After that, when I do localeapp pull, I get the following feedback.

Fetching translations:
Success!
Updating backend:
Success!

However, the added translation doesn't reflect in the local yml file.

@sarojkh thank you for the details. Can you try using localeapp update instead of localeapp pull ?

@thibaultdalban Tried it earlier multiple times. Also, did right now. No luck.

OK ๐Ÿ˜•
Please can you provide me the version of your localeapp gem ?
If you can post the full command line executed to add the translation key, it could help (โš ๏ธ remove your api key if you use the -k option in your command line).

@thibaultdalban
It is localeapp (2.1.1).

I don't use -k option in the command line. I have the key stored as an environment variable, which is used in initializer. See below.

# config/initializers/localeapp.rb 

if ENV['LOCALEAPP_API_KEY'] 
  require 'localeapp'
  require 'localeapp/rails'

  Localeapp.configure do |config|
    config.api_key = ENV['LOCALEAPP_API_KEY'] 
    config.polling_environments = []
    config.sending_environments = []
    config.reloading_environments = []

  end
end

@sarojkh do you try to add a new key or to update an existing key ?
If it is not private, can you post the full key (namespace.name) with the content you try to add or update in each locale ?

Can you confirm this is the process you use:
localeapp add some_key en:the_en_translation
then
localeapp pull or localeapp update

@thibaultdalban I tried creating a new one. I use the process you describe. I usually do localeapp pull.

localeapp add profiles.cash.show_all_for_company en:"Show all cash activities for your organization."

@sarojkh I did not find anything related to translation key named profiles.cash.show_all_for_company in our logs files in the last 15 days. I guess your request did not hit our servers.
Is there any chances you can update to the latest gem version or at least the version 2.2.0 ? We did some improvements about error handling in 2.2.0.

I invite you to open a ticket on the Locale support, then we will be able to know your project and share private informations with you to fix this issue.

@thibaultdalban

Hey, sorry about the translation I provided earlier. I redacted it to make it similar to what was actually being sent. Anyways, here are the couple of actual translations that haven't gone through (or have gone through but do not reflect on the pull).

localeapp add rewards.points.show_summary en:"Show summary of points across your users."
localeapp add rewards.points.show_all_for_company en:"Show all point activities for your organization."

I bumped localeapp version to the latest (from 2.1.1 to 3.1.0). I re-tried adding the translations above, and did a pull to no luck.

Thank you.

@sarojkh OK, that's why! ๐Ÿ˜„
Let me check the log to find your actual translations and get back to you shortly.

@sarojkh your translations cannot be created because there is already a translation key named rewards.points. It is only possible to add keys to a namespace. The gem message can be confusing because it displays:

Sending key: <redacted>
Success!

It doesn't mean the translation has been successfully created, but the translation has been successfully sent. Translation creation is done in an asynchronous job, so it is not possible to return the creation status in the add HTTP response.

I'm really sorry about this behaviour, but we are facing a technical constraint. Maybe we could add an endpoint to request the latest changes requested and their status.

@thibaultdalban Aha! Thanks a lot!

It is only possible to add keys to a namespace.

I knew that but got thrown off by the Success! feedback. This issue can be closed now, I suppose.

Closing.
Sorry for the wasted time introduced by the Success! message ๐Ÿ˜•

@thibaultdalban Is there a possibility of adding a new command under localeapp which could may be scan the local translation file, and check for its sanity? For example, it could have caught this issue I had. Any reason this has not been done?

@sarojkh this is already done on the server side when an entire YAML file is imported. So it should be possible to extract the validation process to a dedicated endpoint.
I added a feature request to implement a new endpoint accepting a YAML file and checking its sanity. I cannot confirm if this feature will be implemented but it's in the icebox.
Thank you for your feature request ๐Ÿ‘