diff --git a/file_entity.file.inc b/file_entity.file.inc
index 4949f4b..5199bf7 100644
--- a/file_entity.file.inc
+++ b/file_entity.file.inc
@@ -275,10 +275,6 @@ function file_entity_set_title_alt_properties($files, $language = NULL) {
   if (!isset($language)) {
     $language = $GLOBALS['language'];
   }
-
-  $alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]');
-  $title = variable_get('file_entity_title', '[file:field_file_image_title_text]');
-
   $replace_options = array(
     'clear' => TRUE,
     'sanitize' => FALSE,
@@ -286,27 +282,8 @@ function file_entity_set_title_alt_properties($files, $language = NULL) {
   );
 
   foreach ($files as $file) {
-    // Load alt and title text from fields.
-    if (!empty($alt)) {
-      $output = token_replace($alt, array('file' => $file), $replace_options);
-
-      if (!empty($output)) {
-        // @todo Remove once https://www.drupal.org/node/1713164 is fixed.
-        // There is currently no way to get the raw alt text returned from the
-        // token so we revert the encoding done during tokenization.
-        $file->alt = decode_entities($output);
-      }
-    }
-    if (!empty($title)) {
-      $output = token_replace($title, array('file' => $file), $replace_options);
-
-      if (!empty($output)) {
-        // @todo Remove once https://www.drupal.org/node/1713164 is fixed.
-        // There is currently no way to get the raw title text returned from the
-        // token so we revert the encoding done during tokenization.
-        $file->title = decode_entities($output);
-      }
-    }
+    $file->title = file_entity_replace_title($file, $replace_options, NULL, $language->language);
+    $file->alt = file_entity_replace_alt($file, $replace_options, NULL, $language->language);
   }
 }
 
diff --git a/file_entity.module b/file_entity.module
index b1fe0f7..af3266c 100644
--- a/file_entity.module
+++ b/file_entity.module
@@ -1250,6 +1250,86 @@ function file_entity_file_formatter_file_field_settings($form, &$form_state, $se
   }
 }
 
+/**
+ * Replace file entity title text.
+ *
+ * @param $file
+ *   The file entity.
+ * @param $replace_options
+ *   (Optional) Options to pass to token_replace().
+ * @param $title
+ *   (Optional) The title text to use.
+ * @param string $langcode
+ *   (Optional) Language code
+ *
+ * @return string
+ *   Returns the replaced title text.
+ */
+function file_entity_replace_title($file, $replace_options = [], $title = NULL, $langcode = NULL) {
+  $replace_options += [
+    'clear' => TRUE,
+    'sanitize' => FALSE,
+  ];
+
+  $title_default = '[file:field_file_image_title_text]';
+  if (!isset($title)) {
+    $title = variable_get('file_entity_title', $title_default);
+  }
+  // If the defaults are not changed then inlining replacement is much faster
+  // than dealing with the token system.
+  if ($title === $title_default) {
+    $title_items = field_get_items('file', $file, 'field_file_image_title_text', $langcode);
+    return $title_items ? $title_items[0]['value'] : '';
+  }
+  elseif (!empty($title)) {
+    $token_replaced = token_replace($title, ['file' => $file], $replace_options);
+    return decode_entities($token_replaced); // Filter out possible XSS.
+  }
+
+  return '';
+}
+
+/**
+ * Replace file entity alt.
+ *
+ * @param $file
+ *   The file entity.
+ * @param array $replace_options
+ *   (Optional) Options to pass to token_replace().
+ * @param $alt
+ *   (Optional) The alt text to use.
+ * @param string $langcode
+ *   (Optional) Language code
+ *
+ * @return string
+ *   Returns the replaced alt text.
+ */
+function file_entity_replace_alt($file, $replace_options = [], $alt = NULL, $langcode = NULL) {
+  $replace_options += [
+    'clear' => TRUE,
+    'sanitize' => FALSE,
+  ];
+
+  $alt_default = '[file:field_file_image_alt_text]';
+
+  if (!isset($alt)) {
+    $alt = variable_get('file_entity_alt', $alt_default);
+  }
+
+  // If the defaults are not changed then inlining replacement is much faster
+  // than dealing with the token system.
+  if ($alt === $alt_default) {
+    $alt_items = field_get_items('file', $file, 'field_file_image_alt_text', $langcode);
+    return $alt_items ? $alt_items[0]['value'] : '';
+  }
+  elseif (!empty($alt)) {
+    $token_replaced = token_replace($alt, ['file' => $file], $replace_options);
+    return decode_entities($token_replaced); // Filter out possible XSS.
+  }
+
+  return '';
+}
+
 /**
  * Implements hook_file_formatter_FORMATTER_view().
  *
@@ -1290,8 +1370,8 @@ function file_entity_file_formatter_file_image_view($file, $display, $langcode)
         '#path' => $file->uri,
         '#width' => isset($file->override['attributes']['width']) ? $file->override['attributes']['width'] : $file->metadata['width'],
         '#height' => isset($file->override['attributes']['height']) ? $file->override['attributes']['height'] : $file->metadata['height'],
-        '#alt' => token_replace($display['settings']['alt'], array('file' => $file), $replace_options),
-        '#title' => token_replace($display['settings']['title'], array('file' => $file), $replace_options),
+        '#alt' => file_entity_replace_alt($file, $replace_options, $display['settings']['alt'], $langcode),
+        '#title' => file_entity_replace_title($file, $replace_options, $display['settings']['title'], $langcode),
       );
     }
     else {
@@ -1300,8 +1380,8 @@ function file_entity_file_formatter_file_image_view($file, $display, $langcode)
         '#path' => $file->uri,
         '#width' => isset($file->override['attributes']['width']) ? $file->override['attributes']['width'] : $file->metadata['width'],
         '#height' => isset($file->override['attributes']['height']) ? $file->override['attributes']['height'] : $file->metadata['height'],
-        '#alt' => token_replace($display['settings']['alt'], array('file' => $file), $replace_options),
-        '#title' => token_replace($display['settings']['title'], array('file' => $file), $replace_options),
+        '#alt' => file_entity_replace_alt($file, $replace_options, $display['settings']['alt'], $langcode),
+        '#title' => file_entity_replace_title($file, $replace_options, $display['settings']['title'], $langcode),
       );
     }
     return $element;
