public PrettyTime setLocale(Locale locale)
   {
      if (locale == null)
         locale = Locale.getDefault();

      this.locale = locale;
      for (TimeUnit unit : units.keySet()) {
         if (unit instanceof LocaleAware)
            ((LocaleAware<?>) unit).setLocale(locale);
      }
      for (TimeFormat format : units.values()) {
         if (format instanceof LocaleAware)
            ((LocaleAware<?>) format).setLocale(locale);
      }
      cachedUnits = null;
      return this;
   }
@Test
   public void testSetLocale() throws Exception
   {
      PrettyTime t = new PrettyTime(now);
      final LocalDateTime threeDecadesAgo = now.minus(3, ChronoUnit.DECADES);
      Assert.assertEquals("3 decades ago", t.format(threeDecadesAgo));
      t.setLocale(Locale.GERMAN);
      Assert.assertEquals("vor 3 Jahrzehnten", t.format(threeDecadesAgo));
   }