Closed (fixed)
Project:
BLEND Localization
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
7 Apr 2013 at 15:00 UTC
Updated:
27 Jan 2016 at 15:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
oyagev commentedI agree.
We will defining two calls as follow:
Optional parameter - "expertise" - will return pairs that support the selected expertise.
This is on the roadmap for the beginning of May.
Comment #2
berdirGreat!
In most cases, when we request the language pair, we're interested in the language pairs for a specific source language, as we know which language we are translating from and want to check if the target language selected by the user is supported, so a source language filter would be important. That would also get the number of results down a lot.
For most translator plugins, we cache that information by source language, so that we don't have to request it again if the target language is changed in the UI, so a target language filter isn't that important for us but might make sense too for other use cases.
Comment #3
miro_dietikerAlso, don't be redundant.
I would only list codes in the pair. A client needs to know your language repository anyway (locally cached) and can use that as a lookup list.
With those lang codes only, say 30 chars per pair incl overhead, we'll have 30kB for 1000 pairs. That's a small payload and doesn't add significant delay.
Just be sure to cache that on the server side too. ;-)
In our case, we will early query the languages, persist/cache them, and later only query for the pair per job / pair request.
If allowed, the pairs will however also be cached for some time.
Comment #4
miro_dietikerComment #5
mbovan commentedProviding a patch. Sorry @oyagev if you worked on this. :P
Applied the patch from #1999992: Update remote languages mappings logic and implemented
getSupportedLanguagePairs()andgetSupportedLanguages().Made some cleanup in default mapping list as well. That was supposed to be done in #1961130: Supported language codes.
Comment #6
berdirsame as in the other, lets just return an empty array.
finally requires PHP 5.5, don't use that in D7.
Just put it at the end, the code will go there anyway if you catch the exception.
cal this method on $translator, then you benefit from the built-in caching there.
Comment #7
mbovan commentedFixed.
Comment #8
mbovan commentedUpdated the list of default languages and sorted them alphabetically. There were some languages (language codes) not supported by Drupal and I commented-out them.
Comment #9
berdirThanks, committed and pushed. Not too happy about the comment style there, but lets make progress.