Skip to main content
expanded example to demonstrate the depth of the answer versus the inefficiency/overhead of the alternative
Source Link

Approach 1 – handling formatting in the frontend – is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

However, in some cases you are obliged to use the other approach (localization in the backend). For example, sorting and pagination - what constitutes "alphabetical order" is culture-dependent, which would appear is, say, the selection of sort order in an SQL query so that the cursor is in the user's culture-appropriate sort order (so that results can be incrementally returned by the cursor, instead of all results returned to the front end, then have the front end reorder all results).

Approach 1 – handling formatting in the frontend – is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

However, in some cases you are obliged to use the other approach (localization in the backend). For example, sorting and pagination - what constitutes "alphabetical order" is culture-dependent.

Approach 1 – handling formatting in the frontend – is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

However, in some cases you are obliged to use the other approach (localization in the backend). For example, sorting and pagination - what constitutes "alphabetical order" is culture-dependent, which would appear is, say, the selection of sort order in an SQL query so that the cursor is in the user's culture-appropriate sort order (so that results can be incrementally returned by the cursor, instead of all results returned to the front end, then have the front end reorder all results).

explicitly mention what 1 and 2 mean
Source Link
amon
  • 136k
  • 27
  • 295
  • 386
  1. is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

Approach 1 – handling formatting in the frontend – is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

However, in some cases you are obliged to use the other approach (2localization in the backend). For example, sorting and pagination - what constitutes "alphabetical order" is culture-dependent.

  1. is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

However, in some cases you are obliged to use (2). For example, sorting and pagination - what constitutes "alphabetical order" is culture-dependent.

Approach 1 – handling formatting in the frontend – is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

However, in some cases you are obliged to use the other approach (localization in the backend). For example, sorting and pagination - what constitutes "alphabetical order" is culture-dependent.

Source Link
pjc50
  • 15.3k
  • 1
  • 37
  • 40

  1. is usually the best answer, as once something has been formatted it is less suitable for further processing. If there are multiple consumers in different cultures it is more natural to handle that closer to the point of use. It also saves you having to pass the culture back up to the API, and consequently simplifies the test coverage.

However, in some cases you are obliged to use (2). For example, sorting and pagination - what constitutes "alphabetical order" is culture-dependent.