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

Swedish language support #3

Closed
Timmyfox opened this issue Nov 25, 2024 · 10 comments
Closed

Swedish language support #3

Timmyfox opened this issue Nov 25, 2024 · 10 comments

Comments

@Timmyfox
Copy link

Timmyfox commented Nov 25, 2024

Hello again! I've began working on the Swedish translation for this, but am faced with a couple few questions when looking over the English language file.

Mainly I'm noticing there is variation in output between the regular and starred versions of the command that goes beyond the documented behavior or disabling hyperlinking. These variations also seem to include varying levels of formality and overall seem a bit arbitrary in which wording is chosen for which scenario.

For instance:

  • A page reference using reftextcurrent generates "on this page" (less formal) normally and "on the current page" (more formal) with the starred version
  • A page reference using reftextafter generates "on the following page" (more formal) normally and "on the next page" (less formal) using the starred version

How should I proceed with translating this? Or should perhaps the variations be split out in a separate "variant" or "formality" setting, independent of the starring?

@gusbrs
Copy link
Owner

gusbrs commented Nov 25, 2024

Hello again! I've began working on the Swedish translation for this [...]

Nice!

[...] but am faced with a couple few questions when looking over the English language file.

Ok.

Mainly I'm noticing there is variation in output between the regular and starred versions of the command that goes beyond the documented behavior or disabling hyperlinking. These variations also seem to include varying levels of formality and overall seem a bit arbitrary in which wording is chosen for which scenario.

For instance:

  • A page reference using reftextcurrent generates "on this page" (less formal) normally and "on the current page" (more formal) with the starred version

  • A page reference using reftextafter generates "on the following page" (more formal) normally and "on the next page" (less formal) using the starred version

When you think you identify an unexpected behavior and report it, you should always present a full minimal working example, if at all possible. Anyway, I doubt this behavior is due to the starred version, and presume it is the repeated use of \zvref.

Essentially, varioref, and zref-vario, make use of \reftextvario (provided by varioref), which takes two arguments, and alternates between them on repeated use. See the documentation of varioref for details.

How should I proceed with translating this? Or should perhaps the variations be split out in a separate "variant" or "formality" setting, independent of the starring?

For example, the English settings:

\zvLanguageSetup { english }
  {
    reftextfaceafter =
      {on~the~\zvhyperlink{\reftextvario{facing}{next}~page}} ,
    reftextfacebefore =
      {on~the~\zvhyperlink{\reftextvario{facing}{preceding}~page}} ,
    reftextafter =
      {on~the~\zvhyperlink{\reftextvario{following}{next}~page}} ,
    reftextbefore =
      {on~the~\zvhyperlink{\reftextvario{preceding}{previous}~page}} ,
    reftextcurrent =
      {on~\reftextvario{}{the~}\zvhyperlink{\reftextvario{this}{current}~page}} ,
    reftextfaraway = {on~\zcpageref{#1}} ,
    reftextpagerange = {on~\zcpageref[range]{#1,#2}} ,
    reftextlabelrange = {\zcref[range]{#1,#2}} ,
  }

You see \reftextvario{this}{current}~page and that's where the alternating effect for reftextcurrent comes from. Similarly for reftextafter.

The swedish localization of varioref uses it like this:

\DeclareOption{swedish}
  {\vref@addto\extrasswedish{%
     \def\reftextfaceafter {p\aa\ \reftextvario{motst\aa ende}%
                                             {n\"{a}sta} sida}%
     \def\reftextfacebefore{p\aa\ \reftextvario{motst\aa ende}%
                                      {f\"{o}reg\aa ende} sida}%
     \def\reftextafter     {p\aa\ \reftextvario{f\"{o}ljande}%
                                            {n\"{a}sta} sida}%
     \def\reftextbefore    {p\aa\ f\"{o}reg\aa ende sida}%
     \def\reftextcurrent   {p\aa\ denna sida}%
     \def\reftextfaraway#1{p\aa\ sidan~\pageref{#1}}%
     \def\reftextpagerange#1#2{p\aa\
                               sidorna~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} till~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}

And this is actually a great reference point for you to use.

@Timmyfox
Copy link
Author

Timmyfox commented Nov 25, 2024

Right, yes in that case that's definitely my misunderstanding the functionality of varioref. I was consistently testing both the starred and non-starred versions like this:

\zvref{...} | \zref*{...}

Anyway, I doubt this behavior is due to the starred version, and presume it is the repeated use of \zvref

Yes this is correct, thank you for the explanation! I will proceed accordingly.

And this is actually a great reference point for you to use.

Absolutely! Most of these seem very much in line with the initial translations I came up with, based on the original English strings. The main difference seem to be the usage of page references, where varioref uses "sidan" instead of "sida" (which relates to the previous discussion in gusbrs/zref-clever#35).

@gusbrs
Copy link
Owner

gusbrs commented Nov 25, 2024

Right, yes in that case that's definitely my misunderstanding the functionality of varioref. I was consistently testing both the starred and non-starred versions like this:

\zvref{...} | \zref*{...}

Anyway, I doubt this behavior is due to the starred version, and presume it is the repeated use of \zvref

Yes this is correct, thank you for the explanation! I will proceed accordingly.

;-)

Absolutely! Most of these seem very much in line with the initial translations I came up with, based on the original English strings. The main difference seem to be the usage of page references, where varioref uses "sidan" instead of "sida" (which relates to the previous discussion in gusbrs/zref-clever#35).

Yes, no doubt. Consistency with zref-clever is what we need to maintain here. Take varioref as a "reference"/"starting point".

@Timmyfox
Copy link
Author

Timmyfox commented Nov 25, 2024

....Aaaand this should be done:

\zvLanguageSetup{ swedish }
  {
    reftextfaceafter =
      {på~\zvhyperlink{\reftextvario{motstående}{nästa}~sida}} ,
    reftextfacebefore =
      {på~\zvhyperlink{\reftextvario{motstående}{föregående}~sida}} ,
    reftextafter =
      {på~\zvhyperlink{\reftextvario{följande}{nästa}~sida}} ,
    reftextbefore =
      {på~\zvhyperlink{föregående~sida}} ,
    reftextcurrent =
      {på~\zvhyperlink{\reftextvario{den~här~sidan}{denna~sida}}} ,
    reftextfaraway = {på~\zcpageref{#1}} ,
    reftextpagerange = {på~\zcpageref[range]{#1,#2}} ,
    reftextlabelrange = {\zcref[range]{#1,#2}} ,
  }

As mentioned in my last comment, compared to the translations provided by varioref I used "sida" instead of "sidan" to be consistent with babel and zref-clever. I also added the the more formal "på den här sidan" ("on this current page") as a variation to reftextcurrent, where varioref's translation only included the more generic/casual "på denna sidan" ("on this page").

Technically a possible variant for reftextbefore is "på förra sidan" ("on the last\previous page"), but I feel this is probably too casual and informal. I also considered the more formal "på den föregående sidan", but felt it was too formal.

Beyond these points, the translations are practically the same as varioref—and since I even came up with them on my own before checking varioref I am fairly confident with them, though they are indeed very straightforward.

@gusbrs
Copy link
Owner

gusbrs commented Nov 25, 2024

As mentioned in my last comment, compared to the translations provided by varioref I used "sida" instead of "sidan" to be consistent with babel and zref-clever. I also added the the more formal "på den här sidan" ("on this current page") as a variation to reftextcurrent, where varioref's translation only included the more generic/casual "på denna sidan" ("on this page").

Technically a possible variant for reftextbefore is "på förra sidan" ("on the last\previous page"), but I feel this is probably too casual and informal. I also considered the more formal "på den föregående sidan", but felt it was too formal.

Beyond these points, the translations are practically the same as varioref—and since I even came up with them on my own before checking varioref I am fairly confident with them, though they are indeed very straightforward.

Ok. It is good you are reaching similar conclusions as varioref. Indeed, varioref is a veeery traditional package. Much more so than cleveref. There's literally more than a generation of experience and accumulated usage there. So, we don't have to follow it, it is "just a reference", but it is a weighty one. ;-)

I think I have one comment there. You say:

I also added the the more formal "på den här sidan" ("on this current page") as a variation to reftextcurrent, where varioref's translation only included the more generic/casual "på denna sidan" ("on this page").

\reftextvario exists to add "a bit of random variation in the generated strings". But perhaps alternating between a "more formal" and a "more casual" alternatives may be a little jarring. Like, is the difference between the two enough to convey a difference in "tone" of the document? If so, this might not work as well as you are envisaging.

@Timmyfox
Copy link
Author

Timmyfox commented Nov 25, 2024

\reftextvario exists to add "a bit of random variation in the generated strings". But perhaps alternating between a "more formal" and a "more casual" alternatives may be a little jarring. Like, is the difference between the two enough to convey a difference in "tone" of the document? If so, this might not work as well as you are envisaging.

The shift in formality is no more than any of the other strings. It's practically equivalent of the "on this page" / "on the current page" variations seen in the English text. I consider it to be well aligned with the rest of the strings. When I say "more formal" and "more casual" I don't necessarily mean it's only applicable to formal or casual text, but more than one is leaning more on the formal side whereas the other is leaning a little less formal/more casual—both are still universal enough to work in both contexts.

This jarring tone shift is also why I dismissed the possible variations mentioned for reftextbefore, as I felt that for those the tone difference would be too great.

This does make me wonder though: I may have missed it in the documentation but is it possible for the user to disable this variation and always use only one (or the other) of the strings provided toreftextvario? If this is the case, I'm thinking it may be worth considering the order in which they are given, so as to group the "slightly more formal" versions and the "slightly less formal" ones, to minimize any mismatch/tone shift if a user were to consistently. If this is not possible then it's fine as is.

@gusbrs
Copy link
Owner

gusbrs commented Nov 25, 2024

The shift in formality is no more than any of the other strings. It's practically equivalent of the "on this page" / "on the current page" variations seen in the English text. I consider it to be well aligned with the rest of the strings. When I say "more formal" and "more casual" I don't necessarily mean it's only applicable to formal or casual text, but more than one is leaning more on the formal side whereas the other is leaning a little less formal/more casual—both are still universal enough to work in both contexts.

This jarring tone shift is also why I dismissed the possible variations mentioned for reftextbefore, as I felt that for those the tone difference would be too great.

Then it is fine. It was just that the way you had described compelled me to double-check with you. I'll prepare things here then.

This does make me wonder though: I may have missed it in the documentation but is it possible for the user to disable this variation and always use only one (or the other) of the strings provided toreftextvario?

Well, it is possible to set these options not to use \reftextvario. There are all user options, the localization the package provides is just a convenient default which should work for most users.

If this is the case, I'm thinking it may be worth considering the order in which they are given, so as to group the "slightly more formal" versions and the "slightly less formal" ones, to minimize any mismatch/tone shift if a user were to consistently. If this is not possible then it's fine as is.

I thought you said the difference in the "degree of formality" of the alternatives was not that large. ;-) I'd just follow tradition here, but I think you are overthinking this. In practice, you don't have this kind of control. The definition of \reftextvario is simply:

\def\reftextvario#1#2{\ifodd\c@vrcnt #1\else#2\fi}

and the counter is stepped every call of

\def\@@vpageref#1[#2]#3{%
  \leavevmode
  \@tempskipa\lastskip \unskip
  \global\advance\c@vrcnt\@ne
[...]

In other words, the sequence of the given alternatives will depend on the order the different calls of \zvref result in each of the cases "current"/"after"/"before"/"faraway", etc. Hence, there's no way to control or guarantee the more "formal" / "casual" variants in each of the cases will have any particular relation in a given concrete document.

gusbrs added a commit that referenced this issue Nov 25, 2024
@gusbrs
Copy link
Owner

gusbrs commented Nov 25, 2024

And it's off to CTAN as well. Thanks again! And do enjoy. :-)

@gusbrs gusbrs closed this as completed Nov 25, 2024
@Timmyfox
Copy link
Author

but I think you are overthinking this

Probably, wouldn't be the first time!

But yeah, all good then 👍

@gusbrs
Copy link
Owner

gusbrs commented Nov 25, 2024

Probably, wouldn't be the first time!

Oh! A fellow member of the club! 😆

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

No branches or pull requests

2 participants