immosquare-translate 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b0c5fd0ef9238480652be786e2daf632acbd15ff0d2409e8e73b97e5ad0edc7
4
- data.tar.gz: 712ec224e35c8208ddf89461b4726f6f2d5cc321d875e00f8a7790d0989a1869
3
+ metadata.gz: f808fdd6b3f1a7432dfeb45bce124db9d13bab1c182841e93aa6bee84adb26a8
4
+ data.tar.gz: f71fc6236e855c048a0363fd97298f0ff7032f224296a6379b06278253173bec
5
5
  SHA512:
6
- metadata.gz: a0d100fd9763d41d9c4530d3e3f1f76ca61d904a2186c4df2ebfc192df052641d78aafa4d332e73c67981520ea86a968b65ec547e3e911bd08dd796c7f604992
7
- data.tar.gz: 4b5d14e40e83956760312d3c6ec55ddf3439082e25b551b7f0e15f14a1e6ad71063864f2bcb6fb13e7343f7e3c7f38e78251f30bb049c81c351cc104fa20b4ea
6
+ metadata.gz: c2b86b7ca922a1af6c4f9011f18e3cdddd601ad45287e63ae2c065423c73e7ce6555ffd3935ed001342baf7e281724cde2198ba6273dd7d2cd99ced02fdaa879
7
+ data.tar.gz: db493502309a3dd33639da02b87ff5bb27df06c0a9e2173772910a6e596f78ae6243cb6c8b8beb98ccb59aa3725f4ca1d0b96154adb260ca9fba7fa1ef8c7283
@@ -57,8 +57,10 @@ module ImmosquareTranslate
57
57
  "Rules to respect:\n" \
58
58
  "- Use the inputted ISO codes for specifying languages.\n" \
59
59
  "- Respond with an array of flat objects in JSON (minified, without any extraneous characters or formatting).\n" \
60
- "- Format the translation output as a JSON string adhering to the following structure: {\"datas\":[{\"locale_iso\": \"Translated Text\"}]} where locale_iso is the language code specifying the language and regional variant.\n" \
61
- "- Ensure that the output does not include markdown (```json) or any other formatting characters. Adhere to the JSON structure meticulously.\n" \
60
+ "- Format the translation output as a direct array of objects, where each object contains translations for one input string.\n" \
61
+ "- Each object in the array should have language codes as keys and translated text as values.\n" \
62
+ "- Ensure that the output does not include markdown (```json) or any other formatting characters.\n" \
63
+ "- Adhere to the JSON structure meticulously.\n" \
62
64
  "- Correct any spelling or grammatical errors in the source text before translating.\n" \
63
65
  "- If the source language is also a target language, include the corrected version of the sentence for that language.\n" \
64
66
  "- If string to translate is html, you should return the translated html.\n" \
@@ -124,6 +126,7 @@ module ImmosquareTranslate
124
126
  ## On s'assure de ne renvoyer que les locales demandées
125
127
  ## car l'API peut renvoyer des locales non demandées...
126
128
  ##============================================================##
129
+
127
130
  datas = JSON.parse(choice["message"]["content"])
128
131
  datas.map do |hash|
129
132
  hash
@@ -1,3 +1,3 @@
1
1
  module ImmosquareTranslate
2
- VERSION = "0.1.16".freeze
2
+ VERSION = "0.1.18".freeze
3
3
  end
@@ -13,7 +13,12 @@ namespace :immosquare_translate do
13
13
  raise("Please provide a valid locale") if !I18n.available_locales.map(&:to_s).include?(source_locale)
14
14
  raise("Please provide a valid boolean for reset_translations") if ![true, false].include?(reset_translations)
15
15
 
16
- locales = I18n.available_locales.map(&:to_s).reject {|l| l == source_locale }
16
+ ##============================================================##
17
+ ## Some applications use regional settings (en-US, fr-FR, etc.).
18
+ ## Normally, these files are just a difference between
19
+ ## the source regional settings and do not need to be translated.
20
+ ##============================================================##
21
+ locales = I18n.available_locales.map(&:to_s).reject {|l| l == source_locale || l.size != 2 }
17
22
  return puts("Any translation asked") if locales.empty?
18
23
 
19
24
  puts("Translations asked :")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - immosquare