Advertisement
jamesan

PKGBUILD for the AUR package, drupal-l10n

Aug 24th, 2014
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.68 KB | None | 0 0
  1. # Maintainer: James An <james@jamesan.ca>
  2.  
  3. pkgname='drupal-l10n'
  4. pkgver='7.31'
  5. pkgrel=1
  6. pkgbase='drupal-l10n'
  7. pkgdesc="Drupal core translation files"
  8. arch=('any')
  9. url="https://localize.drupal.org/translate/projects/drupal"
  10. license=('nonfree')
  11. groups=('drupal')
  12. depends=('drupal')
  13. source=('get-locales-names.php')
  14. md5sums=('9849c031dd27ff240e31d8c153e898eb')
  15.  
  16. # get Drupal's official list of locales keyed by iso code
  17. declare -A _LOCALE_NAMES=$(php -f get-locales-names.php)
  18.  
  19. # known source files keyed by iso code
  20. declare -A _LOCALE_MD5SUMS=(
  21.     [af]='02eec2352849cd07916e1988bfde7a21'
  22.     [am]='d95c36d409baa2b32340289c28835d2a'
  23.     [ar]='0df0bba2cb70e5a444cb2bc3d2a05475'
  24.     [ast]='1d66cff74035cecc662d3e6e5853682b'
  25.     [az]='56521b7be4166df751c79d9bbffbcbcd'
  26.     [be]='f56428a7e76d9fc9d16c3685261ffba8'
  27.     [bg]='70dac81e067228688806c312a8b4fc2a'
  28.     [bn]='e19d5f9bb28d512efec0cd631e4d0a5e'
  29.     [bo]='f3ac3e028d17911c4819b762d3a73ed0'
  30.     [bs]='5a2f81237ea65f3dce7a1d670b0fd35e'
  31.     [ca]='f6b31f7e2aa333cd7a6aa7648430f950'
  32.     [cs]='4ac5cb091168cde6c510de1098411abc'
  33.     [cy]='12f9cf444f2f6d867bbec355d907df99'
  34.     [da]='fa89e7fcc1c74dd0e0ed00ffebba550c'
  35.     [de]='f701f2cd4dc108083eb418d78a9b9990'
  36.     [dz]='a75f893c4e8c0c595dd634e7d4d52ce1'
  37.     [el]='5de740e5685b4efbff906a248d1b98f6'
  38.     [en-gb]='b26b86e9deead3aa34dee4632c6df329'
  39.     [eo]='3e1441c712d70ff6fe3e8c061a7b4ea1'
  40.     [es]='40d14fd3f592af117ffe02b8b03646e1'
  41.     [et]='f5af845a5b03e8f5642da99cea805b64'
  42.     [eu]='d0d48b3d846c4e2002f8ebe0703b5a87'
  43.     [fa]='0f2c5061d630d3df15d23774108cb9eb'
  44.     [fi]='51a47fa29f547f61f7b0cb947cee1034'
  45.     [fil]='3b543866095e3b617f7fed99681fb2e2'
  46.     [fo]='25f4a8acd1d25302f48bc049dc384b0d'
  47.     [fr]='e1c022c473381d35853ccfcf44e77176'
  48.     [fy]='547d0e0c19c5a45033581bf7ea7b9204'
  49.     [ga]='7986029adddc9d6f031e0bb01aad7fd0'
  50.     [gd]='162d1d7b2ee0015c66b590c32963177e'
  51.     [gl]='1aade7ea1dc75c6da1a025508820c751'
  52.     [gsw-berne]='d8d434709c3e975d02546d5e0b7fcbad'
  53.     [gu]='2b2c2786d58f598263f84cd911e108b9'
  54.     [he]='3741f8bf769e0604098f5a7f25ad356b'
  55.     [hi]='4a436aea737ae34ca904a079b130192c'
  56.     [hr]='f2ef939ab9307911da26d15f09d0b6f8'
  57.     [ht]='c5b83e4d41d3058cb87ca32cac96ac37'
  58.     [hu]='c981a15956dacd42d28239da2fb6490a'
  59.     [hy]='f976222bfbd38e60d6fd95252cc81389'
  60.     [id]='44d2e1f97a5deb5d72b47853403c883a'
  61.     [is]='9092e0b66e2e5356b67e982218dc2242'
  62.     [it]='609dc7ab1676f3b73d71d8c0ac97217a'
  63.     [ja]='2959af846eeb771a9943957a0ea8d915'
  64.     [jv]='77fa2695be69f2d75462df3fddce32a7'
  65.     [ka]='bfe77a54ce99a47452128d6336ea75ca'
  66.     [kk]='da5bb46a55743a2ddddcbbe57e9d8c03'
  67.     [km]='92cf8bd0881ef1188d82e3de15a92685'
  68.     [kn]='a0485cb3ba91d4f66d967713f3a65494'
  69.     [ko]='e74181f4a237a481b8a90aaea4903b6d'
  70.     [ku]='e28bc896f8bfb1d86bb9d83bfc2f84b8'
  71.     [ky]='cd754ac8dc53fcfbb054551391f6d3d4'
  72.     [lo]='6b316df42cb19032a95dfcaebd71cfd9'
  73.     [lt]='c6cf41dee6939612f805d78daaa062de'
  74.     [lv]='d6d96cdf8c6848ae6ac84efcbae49361'
  75.     [mg]='75207b4ef3ce59531db2820130b7f6a4'
  76.     [mk]='8ec5eec57a400baddbb613874cde4c33'
  77.     [ml]='442891f9e367a4b5ce6f57312d22f870'
  78.     [mn]='9da573b109d9e135d6deae9cd8b26af7'
  79.     [mr]='7adb3d9d98e814ec3eb548f38ce560e3'
  80.     [ms]='bde801693883d2b5cdf12d12b243a88b'
  81.     [my]='ae304c83c7a6f96ff20e65e702f181c5'
  82.     [nb]='297e10cb0021e0fa5468aff03f4bc285'
  83.     [ne]='6d60d87c1ee0f3d14e0f33c234056f86'
  84.     [nl]='9c7c95ebb35134bf487e723288f4059c'
  85.     [nn]='16f926a5a15680a4e057d066addedaec'
  86.     [oc]='742d220b34960ba984fb2f5665c3c97b'
  87.     [or]='d59716f294765951239714ce719757b8'
  88.     [pa]='30356469d748765fc0c8b5114f606e15'
  89.     [pl]='c40e87d123dc8740053227af0f19e244'
  90.     [pt-br]='654f60ecbfed1978a29748cfe00ea1d3'
  91.     [pt-pt]='6403b238e5d9d7c06ecb99d97263acd1'
  92.     [rhg]='6c187aebc6c457aeb8a679654f5ac7b2'
  93.     [ro]='d399236a80615a54b123874490e09966'
  94.     [ru]='d93aebdc010740a752d7f119c5915c1c'
  95.     [sco]='be6669d204a887a585c154a3729965a8'
  96.     [se]='20d761ebdc6e5fe25b9e79adc862864c'
  97.     [si]='daf5b6c05bf27dad3b564ff102f3575a'
  98.     [sk]='504fcff04f774b073839a3d03956840f'
  99.     [sl]='201ce013db478673bf19631d80aaa89a'
  100.     [sq]='4f60ef36294f5cf306ae47a83b039c8f'
  101.     [sr]='5b4d1dab4752b2f07716b6309910df23'
  102.     [sv]='d647aa951e08fa4917370c2ea31752dd'
  103.     [sw]='db0904250413b68b730e96c47b479e15'
  104.     [ta]='c35edf8449ccd549b78657c50bcba3fb'
  105.     [ta-lk]='d245c29ecb46168f941d6269cf4591dd'
  106.     [te]='f1cde3e56e730a338489f8c5bbca63aa'
  107.     [test]='76504f9bf6bc07b2fc745b33451869f7'
  108.     [th]='84a206df280e4b430a2d385f75f2b603'
  109.     [tr]='be366184a1e0bffd2c40a819bcb2912f'
  110.     [tyv]='15123c16fc244f351a1cfb94653c9a4f'
  111.     [ug]='098a23d0db1886d4dea14b6eaf59342b'
  112.     [uk]='5f9178a915f0e5679693542b14e45683'
  113.     [ur]='d4a66f4148cdb26032a176fbed7f2da5'
  114.     [vi]='8e45ca693afbc254afd0bf947eaacbe9'
  115.     [xx-lolspeak]='aca2dd419801029f5f8423723255dc4d'
  116.     [zh-hans]='e2835643af92238b564ff60e3a3517b4'
  117.     [zh-hant]='87ecece3f52ad1c0c356ef92b645352a'
  118. )
  119.  
  120. # get latest list of locales available to build, otherwise default to pre-fetched list
  121. declare -a _locales=($(curl https://localize.drupal.org/translate/downloads | grep -oh "${pkgver}\.[a-z\-]*\.po" | cut -f3 -d. | sort))
  122. if [ ${#_locales[@]} -eq 0 ]; then
  123.     _locales=(af am ar ast az be bg bn bo bs ca cs cy da de dz el en-gb eo es et eu fa fi fil fo fr fy ga gd gl gsw-berne gu he hi hr ht hu hy id is it ja jv ka kk km kn ko ku ky lo lt lv mg mk ml mn mr ms my nb ne nl nn oc or pa pl pt-br pt-pt ro ru sco se si sk sl sq sr sv sw ta te th tr ug uk ur vi xx-lolspeak zh-hans zh-hant)
  124. fi
  125.  
  126. declare -r _url_source="http://ftp.drupal.org/files/translations/7.x/drupal"
  127. declare -r _url_locale="https://localize.drupal.org/translate/languages"
  128. for _locale in ${_locales[@]}; do
  129.     # skip locale if it's not present in Drupal's official list of locales
  130.     [ ! -v _LOCALE_NAMES[$_locale] \
  131.      -a -v _LOCALE_MD5SUMS[$_locale] ] && continue;
  132.  
  133.     _filename="drupal-${pkgver}.${_locale}.po"
  134.     _localename="${_LOCALE_NAMES[${_locale}]}"
  135.     source[${#source[@]}]="${_url_source}/${_filename}"
  136.     md5sums[${#md5sums[@]}]="${_LOCALE_MD5SUMS[${_locale}]}"
  137.     pkgname[${#pkgname[@]}]="${pkgname[0]}-${_locale}"
  138.  
  139.     # instantiate locale-specific packaging function using parameters: iso code, locale name, and Drupal version
  140.     eval "package_drupal-l10n-${_locale}() {
  141.        pkgdesc=\"Drupal core translation: ${_localename}\"
  142.        url=\"${_url_locale}/${_locale}\"
  143.        install -Dm644 \"\${srcdir}/${_filename}\" \"\${pkgdir}/usr/share/webapps/drupal/profiles/standard/translations/${_filename}\"
  144.    }"
  145. done
  146.  
  147. # meta package depends on all other packages created here
  148. package_drupal-l10n() {
  149.     pkgdesc="Drupal core translation: meta package"
  150.     depends=("${pkgname[@]}")
  151.     unset depends[0] # remove self-dependency
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement