# Translation updates - Mon-Thurs 14th-18th Dec, 2020
I've not done well keeping up with journal entries this week!
I'm now fetching translation files from an AWS CDN link (which I in turn get from a user profile endpoint). As such, updated Apollo RestLink setup to work with alternate domain:
```typescript=
export const restLink = new RestLink({
// allows us to pass custom endpoint URL as translations is fetched from a CDN
endpoints: { translations: '' },
uri: config.API_URL,
bodySerializers: {//...}
})
```
```typescript=
const authLink = setContext(async (operation, { headers }) => {
const token = 'BLAH'
// don't add auth headers when fetching translations
if (operation.operationName === 'getTranslations') {
return {
headers: {
...headers,
},
}
}
return {
headers: {
authorization: token ?? null,
accept: 'ACCEPT_HEADER'
},
}
})
```
I also wanted to improve Firebase logs when their is something caught in `errorLink` that isn't the standard 401 token expired error, so I'm now logging everything potentially useful:
```typescript=
crashlytics().log(`>>>>> 1. NETWORK ERROR: ${netError} ... 2. GRAPHQL ERROR: ${JSON.stringify(
graphQLErrors
)} ... 3. FAILED OPERATION: ${JSON.stringify(operation)}`)
```
Previously, `netError` (as recommended by Apollo) only told me it was, say, a 500 error, with nothing more helpful!
I had to update my keyboard button listener effect slightly as was throwing this strange error:
> `Attempted to remove more RCTKeyboardObserver listeners than added`
```typescript=
// Add button to header for closing keyboard
useEffect(() => {
const showDoneButton = () =>
navigation.setOptions({
headerRight: () => (
<TextButton
accessibilityLabel={t('recognise_message_keyboard_close_button_text')}
accessibilityHint={t('recognise_message_keyboard_close_button_aria_label')}
onPress={() => Keyboard.dismiss()}
style={{ marginRight: HEADER_BUTTON_OFFSET }}
>
{t('recognise_message_keyboard_close_button_text')}
</TextButton>
),
})
const removeDoneButton = () =>
navigation.setOptions({
headerRight: () => <Wrapper mr={HEADER_BUTTON_OFFSET} />,
})
Keyboard.addListener('keyboardDidShow', showDoneButton)
Keyboard.addListener('keyboardDidHide', removeDoneButton)
return () => {
Keyboard.removeListener('keyboardDidShow', showDoneButton)
Keyboard.removeListener('keyboardDidHide', removeDoneButton)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
```
###### tags: `programmingjournal` `2020` `C+` `translation` `authlink` `firebase` `keyboard`