Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added time_format translations #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pedromvieira
Copy link

Support for translation only time part of a datetime.

@padde
Copy link
Owner

padde commented Aug 21, 2017

@pedromvieira Thanks for your work! Will look into this shortly.

Copy link
Owner

@padde padde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got some remarks, please discuss 😉

def time_format(:"zh-CN"), do: {:ok, "%H:%M"}
def time_format(:"zh-HK"), do: {:ok, "%H:%M"}
def time_format(:"zh-TW"), do: {:ok, "%H:%M"}
def time_format(:"zh-YUE"), do: {:ok, "%H:%M"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you take these format strings from? They seem pretty inconsistent to me at first glance, for example most do not include seconds while some do. For example sw, ko, fr-CH.

def time_format(:"es-CR"), do: {:ok, "%I:%M %p"}
def time_format(:"es-EC"), do: {:ok, "%-I:%M %p"}
def time_format(:"es-MX"), do: {:ok, "%I:%M %p"}
def time_format(:"es-PA"), do: {:ok, "%-I:%M %p"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is %-I? Can't seem to find it in the docs.

def time_format(:he), do: {:ok, "%H:%M"}
def time_format(:hi), do: {:ok, "%H:%M"}
def time_format(:"hi-IN"), do: {:ok, "%H:%M"}
def time_format(:hr), do: {:ok, "%e. %B %Y. %H:%M"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this include the date?

@@ -11,7 +11,7 @@ Add `:calendar_translations` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[{:calendar_translations, "~> 0.0.4"}]
[{:calendar_translations, "~> 0.0.5"}]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply from looking at the test case (same code, output changed) we should at least bump the minor version IMO.

def time_format(:csb), do: {:ok, "%H:%M"}
def time_format(:cy), do: {:ok, "%H:%M"}
def time_format(:da), do: {:ok, "%H.%M"}
def time_format(:de), do: {:ok, "%H:%M Uhr"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am German and here you can write timestamps both with and without the "Uhr" suffix. I am honestly not so sure whether we can make this choice for the user. I'd rather be as consistent as possible across locales by choosing the simplest possible version. In this case it would make sense for me to drop the suffix. Not sure whether this is optional in other languages as well.

def time_format(:"zh-CN"), do: {:ok, "%H:%M"}
def time_format(:"zh-HK"), do: {:ok, "%H:%M"}
def time_format(:"zh-TW"), do: {:ok, "%H:%M"}
def time_format(:"zh-YUE"), do: {:ok, "%H:%M"}
def time_format(_), do: {:ok, "%H:%M:%S"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most versions don't include seconds so IMO the fallback should not include them as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants