mc-cms-namelessmc/modules/Core/classes/Avatars/CrafatarAvatarSource.php
Tadhg Boyle 2c21149a1e
Use i18n for translations (#2658)
* Dependency updates

* Start i18n conversion

* Switch to ellipsis character

* Add Dutch language json

* Remove Dutch PHP language files + fix variables

* Further variable fixes

* WIP i18n Language class conversion

* Convert Cookie Consent module to new language format

* Further progress including timeago translations

* Misc

* Replace {x}

* Replace more {x} usage

* {{time}}

this took way too long

* replace last {x}

* Remove comments

So searching for {x} produces relevant results

* forgot to save

* move to onPageLoad

* Accept both string and int

* types in doc

* Remove unused (broken?) function

* Don't convert to string first

* Last arg doesn't seem to be used anywhere

* Time `{x}` replacements

* Email `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* misc `{x}` replacements

* remove comments (makes searching for "{x}" nicer)

* misc `{x}` replacements

* JS `{x}` replacements

* Cleanup language initialization

* Change language constant + add pluralForm support

* Misc language update things

* Add script to find unused terms

* Check all quote types

* Remove most english translations from non-english languages

* Also match with more args

* Missed some apparently

* Missed some (more) apparently

* Misc work

* Add script to convert *all* language files to json

* Fix language codes

* Remove a lot of unused terms

* Remove a lot more unused terms

* Convert everything to JSON, delete old files, get installer working with new system

* Fix general configuration language dropdown + email messages

* Fix page load time, fix language term `set` method

* Fix discord integration command

* Misc

* Misc

* Uncomment RTL definition

* Misc

* Convert links

* Convert links

* Convert links

* Convert links

* Misc work (bolding, fixes, etc)

* Style fix

* Fix variable

* Fix #2668

* Fix old page load timers

* Fix installer group sync injector error

* Convert integration language terms

* Fix more integration language things

* Re-add upgrade script language things

* Resolve PR comments

* Remove unnecessary date()

* Resolve some PR issues

* Fix endpoint

* Style

* Fix Semantic -> Fomantic

* Fix Semantic -> Fomantic

* Return locale short code, not language id/name

Only the short code is interesting to the API, return short code in user info endpoint just like in the website info endpoint.

Also renamed to locale because it's language + region

* Revert "warn people to not translate old language files"

This reverts commit 690b77afff.

* Fix query when there are no filters

* Update 200-pr12.php

* Update footer.php

* insert time into string using placeholder

* Fix getDisplayname case

* Clean username

* PR suggestions

* Include newly created language in converted languages (migration)

* PR suggestions

* PR suggestions

* Update init.php

* Fix default language

Co-authored-by: samerton <samerton@users.noreply.github.com>
Co-authored-by: Robin <robinslot@hotmail.nl>
Co-authored-by: Robin <robin+git@rkslot.nl>
Co-authored-by: Partydragen <adrian_kili@outlook.com>
2022-04-23 14:27:10 +01:00

24 lines
637 B
PHP

<?php
/**
* Crafatar avatar source class
*
* @package Modules\Core\Avatars
* @author Aberdeener
* @version 2.0.0-pr12
* @license MIT
*/
class CrafatarAvatarSource extends AvatarSourceBase {
public function __construct() {
$this->_name = 'Crafatar';
$this->_base_url = 'https://crafatar.com/';
$this->_perspectives_map = [
'face' => 'avatars',
'head' => 'renders/head'
];
}
public function getUrlToFormat(string $perspective): string {
return $this->_base_url . $this->getRelativePerspective($perspective) . '/{identifier}?size={size}&overlay';
}
}