- Add remote_translation_button partial to layout
- Only display button when we have remote_translations and if current
locale is include on available locales from remote translations service.
- Recover available locales from remote translations service.
Use daily_cache to detect every day if remote translation service has
added new available locale.
Co-Authored-By: alessandro <agileontheweb@gmail.com>
We have changed validate_translation method on Globalize concern.
The objective is skip length validations when locale is distinct to
default_locale.
First we force apply :length validations when locale is equal to
default_locale. After we reject :length from options and apply rest
of validation options only when we have more than 1 options.
Ej: options = { length: "maximum: 10" }
When reject :length option in this example, options is equal to a
empty hash and we cant execute validations.
This module is used in a callback model and in charge of
- extracting resources associated from RemoteTranslation and preparing
its fields to be sent to the MicrosoftTranslateClient thought DelayedJobs
- receive the response from MicrosoftTranslateClient and update resource
with his translates
Co-authored-by: javierm <elretirao@gmail.com>
- Create RemoteTranslations Controller to receive resources without
translations and create RemoteTranslation instances when theirs
translations are not enqueued.
- Create remote_translation_enqueued? class method on RemoteTranslation
model to check if exists same remote translations without errors
pending to translate.
- Each RemoteTranslation is associated with a resource (through polymorphic)
and has the locale to we want translate.
- After create a RemoteTranslation we create a enqueue_remote_translation
method that will be send remote translation instance to remote translation
client
- Create concern to reuse the logic of detection of non-existent
translations in Controllers.
- Add detect_remote_translation method:
* This method will be called from controllers to recover resources
without translation.
* Receive arrays of resources.
* Return an array with hashes of remote_translations values for
every resources that have not translations.
* This array will be the param that will be sent from view to
RemoteTranslationController for create remote translations instances.
The existing shared example 'translatable' only works for edit actions.
This shared example allow us to check how translations behaves at new
resource pages.
Now this shared specs only works with Proposals, Budget::Investments and
Debates.
Add missing quotes.
Notification Error:
warning: 2.6.0-dev-compliant syntax, but you are running 2.6.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
2 error(s) were found in ERB files
expected attribute value after '=' (at >)
* Adapt translatable spec helper method to work with budget investments
* Remove old attributes from strong parameters
* Add missing locales to admin.yml and budgets.yml
* Change SpendingProposal.title_max_length and
SpendingProposal.description_max_lenght to Budget::Investment methods
* Add budget investment translatable attribute translations
After adding investment translatable fields to forms, they will be
generated with nested translations names and ids so we can no longer
use standard id locator.
Using input label text to fill in fields works with both types of forms.
As we cannot order budget investments by any translatable field through
AR queries we are doing the same using ruby Array sort method and doing
array pagination manually with Kaminari 'paginate_array' helper method.
Results were not including records without translations for current
locale (I18n.locale). Now we search for given title against all
translation fallbacks for current locale.
To avoid deprecation warning thrown by Globalize after gem update. We
are going to keep these attributes with different names until next
release when we will be able to destroy them.
Also fix sort_by_title method [1]
[1] Use ruby sort instead of active record order scope because Globalize
does not provide a way to search over all available fallbacks when
translation for current locale does not exist.