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

Translation: Add de_CH #1272

Merged
merged 5 commits into from
Nov 23, 2019
Merged

Translation: Add de_CH #1272

merged 5 commits into from
Nov 23, 2019

Conversation

aptevo
Copy link
Contributor

@aptevo aptevo commented Nov 22, 2019

Description

This pull request adds de_CH or Deutsch(Schweiz) to the available languages.
I had not to change any de translations for this, these seem ok for Switzerland too.
This also fixes the issue with some number separators.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I verified that my code applies to the guidelines (composer kimai:code-check)
  • I updated the documentation (see here)
  • I agree that this code is used in Kimai and will be published under the MIT license

@kevinpapst
Copy link
Member

Awesome, thanks 👍

Did you try if the language files are really necessary? I haven't tried yet, but would assume that de_CH falls back to use de if not available.

@kevinpapst kevinpapst added this to the 1.6 milestone Nov 22, 2019
@labor4
Copy link

labor4 commented Nov 22, 2019

What... no dialect??
What about de_CH_zh_stereotypeedition?

just joking. ;-)

@kevinpapst
Copy link
Member

This PR does actually does "nothing". All translations are 100% like the German version.
If I delete all Swiss translation files Kimai will use German as fallback.

Did you read https://www.kimai.org/documentation/translations.html#adding-a-new-language ?

I worked on the PR and pushed some changes, but all configs are also the same.

Besides that you can now select "Deutsch (Schweiz)" in the user profile, I don't see any benefit in this PR. Nothing changes compared to de. I see only one effect: the Javascript gets larger.

This also fixes the issue with some number separators.

What do you mean? What is fixed and how is it fixed if there is no difference to German?

@kevinpapst kevinpapst removed this from the 1.6 milestone Nov 22, 2019
@aptevo
Copy link
Contributor Author

aptevo commented Nov 23, 2019

sorry for the "non-work". the cause for the added language is the java script. without having de-ch, we get wrong number formats, see #1080 (comment) and your answer for that.

This changes the number format in invoices, and on the whole front end from ie. 1.637,90 to 1'637.90.

Reading the docs for me it seemed that I have to add a "complete" language to achieve this , sorry if i was wrong about that. if there is a better solution, just close this PR, and I will try again.

… as they are 100% the same like de and the fallback for de_CH is always de
@kevinpapst
Copy link
Member

Aha, so the number formats are fixed. Well, thats a good argument!
Please have a look at the changed config - the date formats are the same than in de I assume?

@kevinpapst kevinpapst added this to the 1.6 milestone Nov 23, 2019
@aptevo
Copy link
Contributor Author

aptevo commented Nov 23, 2019

Yes, the date formats are also the same.
I just re-checked the translations again and found
messages.de.xliff: Schließen
which should be "Schliessen" for de_CH. I did not find this yesterday, seems this was not my day at all ;-).
It is the only ß I found, so maybe just change it in de, so an extra messages.de_CH.xliff is not needed?

@kevinpapst
Copy link
Member

One can simply create a messages.de_CH.xliff file and only put that one translation into it. The nice thing is that the fallback to de still works.

I just did, you can see how it works if you want to change other translations in the same manner:
bdc5e41

@aptevo
Copy link
Contributor Author

aptevo commented Nov 23, 2019

great, thanks for the information! the doc is not that clear about that, it states in "Adding a new language":

Copy each translation from it’s english version translations/.en.xliff and rename them to translations/.xx.xliff.

Adjust the target-language attributes in the file header, as example for the new file exceptions.xx.xliff:

I will write an update to the doc and create another PR for this.
thanks again!

@kevinpapst
Copy link
Member

Well, thats a special case because of the fallback from de_CH to de. Technically I wouldn't consider de_CH a "new" language, even though I am sure you would say something else ... especially when it comes to the spoken words 😀

Normally the fallback is always English. There are just a couple of translations were this special handling would be used (pt and pt_BR, de and de_CH/de_AT, some chinese "dialects" ...).
The common case is the one described in the docs.

But: yes, please go ahead with a docs PR! Its always good if someone actually using the docs reads and corrects it. When I write it, I already know what to do and therefor it might not include all necessary information.

@kevinpapst kevinpapst merged commit 04dd6b9 into kimai:master Nov 23, 2019
@aptevo
Copy link
Contributor Author

aptevo commented Nov 23, 2019

I would describe de_CH not as a new language, but as a lets say "very special" variant ;-)

Is the "special handling" automatically used for every variant added, so if I added an fr_CH the fallback will be fr?

@kevinpapst
Copy link
Member

Yes, the fallback is always the language code (fr) without the region code (CH).

@kevinpapst
Copy link
Member

You can test the integration at https://demo-branch.kimai.org/de_CH/timesheet/
with username susan_super and password kitten

@aptevo
Copy link
Contributor Author

aptevo commented Nov 23, 2019

looks good. what's strange is that the number format is from ch-de even when the language setting is Deutsch and not Deutsch(Schweiz) - it seems as at least the number format on the frontend and the invoice derives from the browser language settings, if the browser language exists in in kimai JS - doesn't this make the settings in Kimai a bit inconsistent?

@kevinpapst
Copy link
Member

kevinpapst commented Nov 23, 2019

All formatting should be exclusively taken from the current requests locale.
And this is the one in the URL (not necessarily the one configured in the users profile).
Please check if you mistakenly used multiple tabs without changing the locale in the URL.
The users profile language is only used after the initial login, to redirect to the correct language.

It's harder to spot if the translations don't change.

At least this changes the money formatting correct for me:

Can you please check again if you still experience the problem, and if so describe in detail what is wrong and in which place.

@aptevo
Copy link
Contributor Author

aptevo commented Nov 23, 2019

I checked again with lots of different settings of the browser and the application and you are absolutely right. It must have been that I accidentally reused an url from the browser history in one of the tests, all works perfectly as intended, sorry for the false alarm.

@kevinpapst
Copy link
Member

No need to be sorry ;) qualified feedback is always very welcome!

@aptevo aptevo deleted the add_de_ch branch November 23, 2019 12:10
@lock
Copy link

lock bot commented Jan 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

@lock lock bot locked and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants