-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Chinese zh_* Translation "From Now" #1782
Comments
Hi @danvim the calculation and rounding will not change from one locale to an other, we have 823 locales, it would unmaintainable. By default, we use the biggest unit possible and floor the value, here it means we count full monts: echo Carbon::now()->addMonths(2)->subSecond()->diffForHumans(); // 1 month from now
echo "\n";
echo Carbon::now()->addMonths(2)->addSecond()->diffForHumans(); // 2 months from now But you can use more precise diff having multiple units: echo Carbon::now()->addDays(50)->diffForHumans(['parts' => 3]); // 1 month 2 weeks 4 days from now
echo "\n";
echo Carbon::now()->addDays(50)->locale('zh_TW')->diffForHumans(['parts' => 3]); // 1個月 2週 4天內 Thanks! |
And also note than if you compare 2 dates, echo Carbon::now()->addMonths(2)->addSecond()->locale('zh_TW')->diffForHumans(Carbon::now(), ['parts' => 3]); // 1個月 2週 4天後 echo Carbon::now()->addMonths(2)->addSecond()->locale('zh_TW')->diffForHumans(Carbon::now()); // 1個月後 |
@kylekatarnls Thanks for replying. I'm fully aware of what you are saying. The reason I bring this up is to open this discussion to improve the translation. I have no intention of modifying the code base. However, I couldn't think of a proper way to phrase the exact situation in Chinese. Therefore, I'm asking if anyone else seeing this issue could think of a better translation. If you ask me, I still think this issue can be open for discussion though. |
Hi @danvim, @williamyang233 suggested Do you think it should apply to zh_TW? And other zh_*? |
@kylekatarnls I think it is at least better than the one that is in the current translation. The only thing is the Chinese translation would be the same for the actual "after" translation as well. Well, I can't think of any better translation so |
OK, thanks @danvim it seems no one had much better to propose so we will go for the same translation of after and from_now. Thanks for your help. |
@kylekatarnls I'm sorry I missed. The zh_HK translation should also use the Traditional Chinese form. 🙇 In fact, the original zh_HK.php //...
'from_now' => ':time後',
'after' => ':time後',
//... |
This would be a major and global change (not only for after/from_now) as right now the whole zh_HK uses the same as zh_Hans. Do we should get the same translations for zh_HK and zh_Hant for all keys? |
@kylekatarnls Hong Kong uses Traditional Chinese. So it would basically use what Taiwan zh_TW is using without any doubt. So whichever has more keys: Hant or TW, HK should be using those instead of CN or Hans. |
OK, thanks I created a new issue for this: #1824 |
* Unbind $this in macros only for PHP < 8 * Privatize loadMixin* method as reserved for mixin() method * Temporary disabling binding $this/static for PHP 8 * Set specific tests for each macros in PHP 7 and 8 * Persian language localization fixes * Update Persian translations unit tests * Update uz_Arab and mzn translations unit tests * Fix briannesbitt#1816 from now translation in Chinese * Update zh tests * Add explicit imports and update composer description * Cleanup PHPDoc * Cleanup PHPDoc * briannesbitt#1782 Fix from_now translation in Chinese * Add comparison methods for CarbonPeriod bounds * Add PHPDoc comments * Allow string and interval in floor, round and ceil * Implement carbonize() method get a Carbon date from interval/period/any * Add rounding methods to CarbonInterval/CarbonPeriod * Fix PHPDoc and add tests * Fix PHPDoc for Carbon rounding methods * Fix self references * Add tests * Add cast() method and traits mixins to CarbonInterval and CarbonPeriod * Allow static methods in mixin traits * Update CarbonInterface PHPDoc * briannesbitt#1822 Use less short variants for short units in Polish * Make zh_HK and zh_TW extend Hant/Hans * Implement contains() and JsonSerializable in CarbonPeriod * Implement new methods in CarbonPeriod - getIncludedStartDate() - getIncludedEndDate() - follows() - isFollowedBy() - isConsecutiveWith() * Simplify duplicate code * [Travis-CI] Simplify xdebug settings * Mute deprecation notice * Ignore mutability in equalTo comparison of periods * Fix unit tests * Fix typo * Fix getIncludedEndDate * Improve any native PHP classes and sub-classes as cast * Fix briannesbitt#1831 Refresh global translator caching * Add cast tests * Take recurrences DatePeriod incrementation into account * Mute type wrong PHPStan detections in tests * Fix briannesbitt#1834 language detection in Lumen * Make zh_Hans inherit from zh_Hant * Add altNumbers option to forHumans/diffForHumans * Fix alternate numbers in hours * Ensure consistent output typing * Add tests for altNumbers option briannesbitt#1817 * Fix briannesbitt#1837 fixed from_now translation in Fnnish and add few seconds * briannesbitt#1837 Update Finnish tests * Fix briannesbitt#1840 add short form or year for year in Turkish * Update Turkish unit tests * Fix PHP 8 compatibility * Add doc for setDate() * briannesbitt#1837 Add translation author * Fix setISODate PHP 8 signature compatibility * Implement methods that change of signature in PHP 8 * Allow null in __set_state for compatibility with PHP 8 Possible error to fix in PHP: php/php-src#4526 * Remove temporary fix as fixed in PHP itself: php/php-src@b17957e * Remove obsolete tests * Allow PHP 8 tests to fail until new PHP build is released * Add test for setISODate() * Fix Chinese Hant/Hans and meridiem * [AR] Update with enhancements * More enhancements * Update files and fixing test unit * Fix StyleCI issues * Fix briannesbitt#1851 Update all Carbon classes on Laravel locale change * Remove irrelevant test * Fix PHP 8 compatibility * Use require everywhere instead of include * Implement briannesbitt#1856 Allow strings in isSame* methods * Update PHPDoc and add tests * Fix 1860 Allow Closure in setTestNow() * Add create() test in Carbon::setTestNow() * Fix briannesbitt#1861 Add aUnit option in Thai * briannesbitt#1861 Add @nithisa authorship * Allow to control timezone in testNow Closure * Add PHPDoc * Synchronize CarbonPeriod and CarbonInterval with Laravel locale Thanks to @craig-sen to point out this * Simplify swap expressions * Reset language for all classes before running Laravel locale test * Improve period/interval string detection in Carbon::make() This allows to use make() with customized parse() methods * Fix briannesbitt#1842 Latvian declension, aUnit and short units * Add previous author complete name * Fix zh locales merging * Remove irrelevant zh_MO overrides * Corrected sl-SI * briannesbitt#1828 Make spaces around numbers consistent (both sides or none) * briannesbitt#1824 Fix interpolations precedence and ordering * Add missing tests * Fix code style * Update Slovenian unit tests * Apply ago/from_now/before/after declension in multi-parts diffs * briannesbitt#1849 Add Slovenian short units and "from now" declension * briannesbitt#1800 Fix Lithuanian declensions * briannesbitt#1800 Update Lithuanian tests * briannesbitt#1800 Add Lithuanian calendar and ordinal numbers translations * briannesbitt#1800 Fix Lithuanian year nominative 11+ plural * briannesbitt#1800 Decline after translations like from_now ones * briannesbitt#1800 Fix units plural * briannesbitt#1857 Fix static methods typing autocompletion * Add recurrences support in Carbon::toPeriod() * Fix code style * briannesbitt#1814 Remove error muter * Fix briannesbitt#1877 Support timezone short offset format * Nit: Grammar (briannesbitt#1880) https://writingexplained.org/a-vs-an-difference * Use static notation for called class * Allow to get context from macros using self::this() * Add missing import * Remove typehint specificity * Fix isBefore documentation There was an error in the documentation of the function isBefore. 2018-07-25 12:45:16 is before 2018-07-25 12:45:18. * Fix briannesbitt#1886 Support slashes in hasFormat() * briannesbitt#1886 Add hasFormat() tests * briannesbitt#1889 Fix Belarusian units translations * briannesbitt#1893 Fix hour translation to година * briannesbitt#1889 Fix Belarusian aUnit option translations * briannesbitt#1893 Fix hour Ukrainian units translations * briannesbitt#1889 Fix Belarusian aUnit option translations tests * Add translation authors * Fix briannesbitt#1902 Make hr_BA inherit hr language * Replace $this with CarbonInterface in PHPDoc (briannesbitt#1904) * Replace $this with CarbonInterface in PHPDoc * [PHPStan] Ignore Carbon interface to instances mismatch * Fix briannesbitt#1910 seconds Serbo-Croatian translation (briannesbitt#1911) * Fix briannesbitt#1910 seconds Serbo-Croatian translation * briannesbitt#356 Add toDateTimeLocalString precision parameter * Add documentation for getTimeFormatByPrecision * Add $unitPrecision parameters to relevant methods Add $unitPrecision parameters to: - toTimeString - toDateTimeString - toIso8601ZuluString * Update PHPDoc * Fixed all greater examples Fixed bad one + changed date to have at least 1 true example * Fix comparison examples * Improve typings * Apply fixes from StyleCI (briannesbitt#15) * Fix typings * Fix typehint for static create methods (Fix briannesbitt#1914) * added new CreateFromFormat method to CarbonInterval * fixed CarbonInterval::createFromFormat() dockblock added example fixed return type * added CarbonInterval::createFromFormat() tests * fixed tests inputs * fixed tests testDefaults() and testNulls() * Add diff translate * Add option for rounding in forHumans * Fix code style * Implement custom interval formats parsing * Fix too short variable name * Use customizable factors for forHumans() rounding * Add test for gap * Use dedicated method to get the round factor * Fix briannesbitt#1927 Finnish future interval translations * Add rounding methods * Implement FLOOR and CEIL options * Fix code style * Remove unused variable creation * Remove unused method getRoundFactor * Fix briannesbitt#1929 Indonesian from now translation * Allow Symfony 5 * Show difference between FLOOR option and no option * Fix briannesbitt#1908 Korean spacing and aUnit option * Add 2.x-dev branch alias * Added diff before_yesterday and after_tomorrow * briannesbitt#398 Skip tests with easter_days() if ext-calendar is missing * [Travis-CI] Remove unneeded dev dependency from the install * Fix briannesbitt#1941 Symfony 5 compatibility * Fix briannesbitt#1941 Replace Symfony custom rules with inline syntax * briannesbitt#1941 Set me and scr locales as aliases * Compare locales handling aliases * Fix briannesbitt#1943 Add example for H:s.vi (briannesbitt#1944) * Fix briannesbitt#1943 Add example for H:s.vi * Fix briannesbitt#1943 Drop support of .v for PHP < 7.3 * Fix test PHP < 7.2 compatibility * Add test for unit accumulation in interval rounding * Fix briannesbitt#1949 Use format('T') to match ISO 8601 timezone format (briannesbitt#1950) * Fix briannesbitt#1951 createFromTimestamp in DST chnge * briannesbitt#1951 Add test for createFromTimestampMs * [Travis-CI] Switch to PHP 7.4 stable release * briannesbitt#1871 Improve translations using CLDR database (briannesbitt#1955) * Fix briannesbitt#1953 Align Korean translation on CLDR (briannesbitt#1956) * Fix briannesbitt#1954 Improvement from-now Armenian translation (briannesbitt#1957) * Fix briannesbitt#1958 Standardize integer timezone input * Fix briannesbitt#1958 Remove timezone auto-detection * Fix PHPDoc alignment * Add timezone unit tests * Ease tests with OS locales dependency * Fix briannesbitt#1968 Turkmen year and short days translations * Added briannesbitt#1966 Tamil before and after translations * Update Teso unit tests files * Use CarbonInterface instead of self for Date trait constant as keys * Speed up resetMessages * Update PHPMD * Add strict restrictions for translator requirements * Fix Symfony 3 compatibility * Fix month overflow sensibility of quarter tests * Use common method for translators able to getLocale() * Add unit tests for NotLocaleAwareException * Fix method signature compatibility * Use include instead of require to not stop the process if lang file is missing * Fix briannesbitt#1970 Uzbek before/after translations * Cleanup imports * Fix briannesbitt#1977 Greek "ago" translation Co-authored-by: Kyle <kylekatarnls@users.noreply.github.com> Co-authored-by: Hassan Pezeshk <hpez58@gmail.com> Co-authored-by: Mohamed Sabil <me@mohamedsabil83.com> Co-authored-by: Gal Jakič <gal.jakic@gmail.com> Co-authored-by: Arthur Cinader <700572+acinader@users.noreply.github.com> Co-authored-by: Marc-Antoine Bouchard Marceau <marcantoine.bouchardm@gmail.com> Co-authored-by: karlyn33 <karlyn33@users.noreply.github.com> Co-authored-by: spaceemotion <spaceemotion@users.noreply.github.com> Co-authored-by: silvio-gratani <42873063+silvio-gratani@users.noreply.github.com> Co-authored-by: dima-bzz <dimabzz@gmail.com> Co-authored-by: Tyler Collier <github@tylercollier.com> Co-authored-by: Graham Campbell <GrahamCampbell@users.noreply.github.com>
Hello,
I encountered an issue with the following code:
Carbon version: 2.20
PHP version: 7.3
I wish to start a discussion regarding the translation in file zh_TW:
https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Lang/zh_TW.php#L44
This line contains:
'from_now' => ':time內',
I expected to get:
But I actually get:
The English "1 month from now" seems appropriate, but from my understanding, the Chinese "1個月內" means "within 1 month", which conflicts with the idea of "50 days away from today".
"1個月後" meaning "after 1 month" might seem more appropriate?
Thanks!
The text was updated successfully, but these errors were encountered: