cameraPickerTextDelegateFromLocale function

CameraPickerTextDelegate cameraPickerTextDelegateFromLocale(
  1. Locale? locale
)

Obtain the text delegate from the given locale.

Implementation

CameraPickerTextDelegate cameraPickerTextDelegateFromLocale(Locale? locale) {
  if (locale == null) {
    return const CameraPickerTextDelegate();
  }
  final String languageCode = locale.languageCode.toLowerCase();
  for (final CameraPickerTextDelegate delegate in cameraPickerTextDelegates) {
    if (delegate.languageCode == languageCode) {
      return delegate;
    }
  }
  return const CameraPickerTextDelegate();
}