So here is my issue;
I got a price in a Number (decimal) field in a node, I need to process this number in some ways depending on users interactions then send it back (via an ajax request) as an integer, but also formatted with proper currency sign which is stored in the fields prefix/suffix settings.
I should mention that this should also work with translations of the price and its prefix/suffixes.
I get the price now this way;
$node = \Drupal::entityTypeManager()->getStorage('node')->load($node_id); $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $translated_node = $node->getTranslation($language); $price = $translated_node->get('field_price')->getValue()['value'];`
So now I want to constuct a formated variable with the translated prefix/suffix depending on which language is curretly selected.